fix: root key may not expand after switch to check mode in key tree

This commit is contained in:
Lykin 2024-01-03 01:08:11 +08:00
parent 5e970982a2
commit 84b73bd5e7
1 changed files with 4 additions and 3 deletions

View File

@ -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' },