diff --git a/src/views/account_center/sub_account/components/organization/organization-tree.vue b/src/views/account_center/sub_account/components/organization/organization-tree.vue index 68f4386..028131c 100644 --- a/src/views/account_center/sub_account/components/organization/organization-tree.vue +++ b/src/views/account_center/sub_account/components/organization/organization-tree.vue @@ -81,17 +81,11 @@ watch(filterText, val => { const handleNodeClick = (data: Tree) => { parent?.setSelectedNode(data) } -// 默认设置选中节点 -watch( - () => props.currentNodeKey, - val => { - if (val) { - nextTick(() => { - treeRef.value?.setCurrentKey(val) - }) - } - } -) +const setCurrentKey = (val: any) => { + nextTick(() => { + treeRef.value?.setCurrentKey(val) + }) +} const handleCommand = (args: any[], data: Tree) => { const command = args[0] switch (command) { @@ -106,6 +100,9 @@ const handleCommand = (args: any[], data: Tree) => { break } } +defineExpose({ + setCurrentKey +})