fix-bug -- 使用TreeSelect组件后,重置按钮无法置空该组件值

This commit is contained in:
wenhan 2022-01-12 10:24:25 +08:00
parent a7b867ff09
commit 103b08937a
1 changed files with 3 additions and 1 deletions

View File

@ -82,13 +82,15 @@ const defaultExpandedKey = ref([]);
function initHandle() { function initHandle() {
nextTick(() => { nextTick(() => {
const selectedValue = valueId.value; const selectedValue = valueId.value;
if(selectedValue !== null && typeof (selectedValue) !== "undefined"){ if(selectedValue && selectedValue !== null && typeof (selectedValue) !== "undefined"){
const node = proxy.$refs.selectTree.getNode(selectedValue) const node = proxy.$refs.selectTree.getNode(selectedValue)
if (node) { if (node) {
valueTitle.value = node.data[props.objMap.label] valueTitle.value = node.data[props.objMap.label]
proxy.$refs.selectTree.setCurrentKey(selectedValue) // proxy.$refs.selectTree.setCurrentKey(selectedValue) //
defaultExpandedKey.value = [selectedValue] // defaultExpandedKey.value = [selectedValue] //
} }
}else{
clearHandle()
} }
}) })
} }