mirror of
https://github.com/element-plus/element-plus.git
synced 2024-12-03 02:21:49 +08:00
fix: [el-cascader] multiple search with v-model can't work (#3350)
Co-authored-by: Kevin <sxzz@sxzz.moe>
This commit is contained in:
parent
be58b742ef
commit
5978ebdabd
@ -100,23 +100,36 @@ export default defineComponent({
|
|||||||
)
|
)
|
||||||
const renderLabelFn = computed(() => props.renderLabel || slots.default)
|
const renderLabelFn = computed(() => props.renderLabel || slots.default)
|
||||||
|
|
||||||
|
let oldConfig: typeof config
|
||||||
|
let oldOptions: CascaderOption[]
|
||||||
const initStore = () => {
|
const initStore = () => {
|
||||||
const { options } = props
|
const { options } = props
|
||||||
const cfg = config.value
|
const cfg = config.value
|
||||||
|
|
||||||
manualChecked = false
|
const configTemp = config
|
||||||
store.value = new Store(options, cfg)
|
if (
|
||||||
menus.value = [store.value.getNodes()]
|
oldOptions === undefined ||
|
||||||
|
oldOptions !== options ||
|
||||||
|
oldConfig === undefined ||
|
||||||
|
configTemp !== oldConfig
|
||||||
|
) {
|
||||||
|
manualChecked = false
|
||||||
|
store.value = new Store(options, cfg)
|
||||||
|
menus.value = [store.value.getNodes()]
|
||||||
|
|
||||||
if (cfg.lazy && isEmpty(props.options)) {
|
if (cfg.lazy && isEmpty(props.options)) {
|
||||||
initialLoaded = false
|
initialLoaded = false
|
||||||
lazyLoad(null, () => {
|
lazyLoad(null, () => {
|
||||||
initialLoaded = true
|
initialLoaded = true
|
||||||
|
syncCheckedValue(false, true)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
syncCheckedValue(false, true)
|
syncCheckedValue(false, true)
|
||||||
})
|
}
|
||||||
} else {
|
|
||||||
syncCheckedValue(false, true)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
oldConfig = configTemp
|
||||||
|
oldOptions = options
|
||||||
}
|
}
|
||||||
|
|
||||||
const lazyLoad: ElCascaderPanelContext['lazyLoad'] = (node, cb) => {
|
const lazyLoad: ElCascaderPanelContext['lazyLoad'] = (node, cb) => {
|
||||||
@ -322,7 +335,7 @@ export default defineComponent({
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
watch([config, () => props.options], initStore, {
|
watch([config, () => props.options], () => initStore(), {
|
||||||
deep: true,
|
deep: true,
|
||||||
immediate: true,
|
immediate: true,
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user