From 84b73bd5e7ab1012442dd70ce33a9371abc7cc05 Mon Sep 17 00:00:00 2001 From: Lykin <137850705+tiny-craft@users.noreply.github.com> Date: Wed, 3 Jan 2024 01:08:11 +0800 Subject: [PATCH] fix: root key may not expand after switch to check mode in key tree --- frontend/src/components/sidebar/BrowserTree.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/sidebar/BrowserTree.vue b/frontend/src/components/sidebar/BrowserTree.vue index cb79558..94b87b5 100644 --- a/frontend/src/components/sidebar/BrowserTree.vue +++ b/frontend/src/components/sidebar/BrowserTree.vue @@ -171,12 +171,13 @@ const renderContextLabel = (option) => { /** * * @param {string} key + * @param {boolean} [toggle] */ -const expandKey = (key) => { +const expandKey = (key, toggle) => { const idx = indexOf(expandedKeys.value, key) if (idx === -1) { expandedKeys.value.push(key) - } else { + } else if (toggle !== false) { expandedKeys.value.splice(idx, 1) } } @@ -562,7 +563,7 @@ watchEffect( if (!props.checkMode) { tabStore.setCheckedKeys(props.server) } else { - expandKey(`${ConnectionType.RedisDB}`) + expandKey(`${ConnectionType.RedisDB}`, false) } }, { flush: 'post' },