-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Open
Labels
Description
Version
Vben Admin V5
Describe the bug?
Tree.vue 组件,源码地址: https://github.com/vbenjs/vue-vben-admin/blob/main/packages/%40core/ui-kit/shadcn-ui/src/ui/tree/tree.vue
在使用tree.vue组件时, 若指定了 default-expanded-level ,若实际的层级超过 默认展开层级, 每次点击超过的层级,会出现: 1. 无法勾选 2. 自动搜索 的情况。
例如: 实际树结构有5层, 设置了 :default-expanded-level="2" 后, 点击第3层以后的任意节点,都无法选中,且每次点击都会将展开状态变为收缩状态。
<VbenTree
:default-expanded-level="2"
/>
排查后,推断问题大概出现在这个位置:
onMounted(() => {
watchEffect(() => {
flattenData.value = flatten(props.treeData, props.childrenField);
updateTreeValue();
if (
props.defaultExpandedLevel !== undefined &&
props.defaultExpandedLevel > 0
)
expandToLevel(props.defaultExpandedLevel);
});
});
Reproduction
System Info
最新版本Relevant log output
Validations
- Read the docs
- Ensure the code is up to date. (Some issues have been fixed in the latest version)
- I have searched the existing issues and checked that my issue does not duplicate any existing issues.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.