🐛(component): cascader组件 外部清空modelValue内部displayValue不清空问题

This commit is contained in:
0o张不歪o0 2022-09-21 09:52:57 +08:00
parent 85a7217c47
commit 8928f341b7
2 changed files with 18 additions and 0 deletions

View File

@ -111,6 +111,14 @@ watch(
initTreeData();
}
);
watch(
()=>props.modelValue,
()=>{
if(props.modelValue===null||props.modelValue===''){
onClear();
}
}
);
const treeData = ref<any>([]);
const initTreeData = () => {
@ -266,6 +274,7 @@ const dropDownDisabled = ref(false);
//
const onClear = () => {
displayValue.value='';
dropDownDisabled.value = true;
let arr = JSON.parse(JSON.stringify(treeData.value));
for (let index = 0; index < arr.length; index++) {

View File

@ -11,6 +11,15 @@
<template>
<lay-timeline>
<lay-timeline-item title="1.4.x">
<ul>
<a name="1-4-14"></a>
<li>
<h3>1.4.15 <span class="layui-badge-rim">2022-09-27</span></h3>
<ul>
<li>[修复] cascader 外部清空modelValue, 内部displayValue不清空问题。</li>
</ul>
</li>
</ul>
<ul>
<a name="1-4-14"></a>
<li>