fix: 修复问题

This commit is contained in:
xlsea
2025-05-11 15:40:24 +08:00
parent 498b4d866d
commit 873424e65a
4 changed files with 27 additions and 23 deletions

View File

@ -51,19 +51,14 @@ onMounted(() => {
});
// 添加 watch 监听 expandAll 的变化,options有值后计算expandedKeys
watch(
[expandAll, options],
([newVal]) => {
if (newVal) {
// 展开所有节点
expandedKeys.value = getAllMenuIds(options.value);
} else {
// 折叠到只显示根节点
expandedKeys.value = [0];
}
},
{ immediate: true }
);
watch([expandAll, options], ([newVal]) => {
if (newVal) {
// 展开所有节点
expandedKeys.value = getAllMenuIds(options.value);
} else {
expandedKeys.value = [0];
}
});
function renderPrefix({ option }: { option: TreeOption }) {
const renderLocalIcon = String(option.icon).startsWith('icon-');