🐛(component): cascader组件 外部清空modelValue内部displayValue不清空问题
This commit is contained in:
		
							parent
							
								
									85a7217c47
								
							
						
					
					
						commit
						8928f341b7
					
				@ -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++) {
 | 
			
		||||
 | 
			
		||||
@ -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> 
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user