From 103b08937aeb945a0ff503dfdedf268b9a55dade Mon Sep 17 00:00:00 2001 From: wenhan <1196086345@qq.com> Date: Wed, 12 Jan 2022 10:24:25 +0800 Subject: [PATCH] =?UTF-8?q?fix-bug=20--=20=E4=BD=BF=E7=94=A8TreeSelect?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=90=8E=EF=BC=8C=E9=87=8D=E7=BD=AE=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E6=97=A0=E6=B3=95=E7=BD=AE=E7=A9=BA=E8=AF=A5=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/TreeSelect/index.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/TreeSelect/index.vue b/src/components/TreeSelect/index.vue index 7eef938..bb78fe4 100644 --- a/src/components/TreeSelect/index.vue +++ b/src/components/TreeSelect/index.vue @@ -82,13 +82,15 @@ const defaultExpandedKey = ref([]); function initHandle() { nextTick(() => { const selectedValue = valueId.value; - if(selectedValue !== null && typeof (selectedValue) !== "undefined"){ + if(selectedValue && selectedValue !== null && typeof (selectedValue) !== "undefined"){ const node = proxy.$refs.selectTree.getNode(selectedValue) if (node) { valueTitle.value = node.data[props.objMap.label] proxy.$refs.selectTree.setCurrentKey(selectedValue) // 设置默认选中 defaultExpandedKey.value = [selectedValue] // 设置默认展开 } + }else{ + clearHandle() } }) }