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)
|
||||
|
||||
let oldConfig: typeof config
|
||||
let oldOptions: CascaderOption[]
|
||||
const initStore = () => {
|
||||
const { options } = props
|
||||
const cfg = config.value
|
||||
|
||||
manualChecked = false
|
||||
store.value = new Store(options, cfg)
|
||||
menus.value = [store.value.getNodes()]
|
||||
const configTemp = config
|
||||
if (
|
||||
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)) {
|
||||
initialLoaded = false
|
||||
lazyLoad(null, () => {
|
||||
initialLoaded = true
|
||||
if (cfg.lazy && isEmpty(props.options)) {
|
||||
initialLoaded = false
|
||||
lazyLoad(null, () => {
|
||||
initialLoaded = true
|
||||
syncCheckedValue(false, true)
|
||||
})
|
||||
} else {
|
||||
syncCheckedValue(false, true)
|
||||
})
|
||||
} else {
|
||||
syncCheckedValue(false, true)
|
||||
}
|
||||
}
|
||||
|
||||
oldConfig = configTemp
|
||||
oldOptions = options
|
||||
}
|
||||
|
||||
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,
|
||||
immediate: true,
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user