naive-ui
naive-ui copied to clipboard
n-tree组件在开启virtual-scroll虚拟滚动,并且设置default-expand-all="true"默认展开所有节点时渲染报错
Describe the bug
在使用n-tree组件过程中,设置虚拟滚动virtual-scroll,并且设置default-expand-all="true"默认展开所有节点时,页面树节点渲染失败。
特别说明:使用官网示例中的部分数据时,可以正常渲染。使用我示例中的数据时无法渲染。
Steps to reproduce
1、创建一个测试页面,在页面中引用n-tree组件,一定要设置block-line、virtual-scroll、data和default-expand-all="true"; 2、定义树节点数据数组:const treeData = reactive([]); 3、定义树节点选中节点数组:const nodeSelectedKeys = reactive([]); 4、定义页面挂载时加载数据,调用加载数据接口; 5、在加载数据函数中,获取到数据后,赋值给treeData;
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-t1uxeglc?file=src%2FApp.vue
System Info
操作系统:macOs Big Sur 11.7.10
浏览器:Google Chrome 135.0.7049.86
naive-ui版本:2.41.0
Used Package Manager
pnpm
Validations
- [x] Read the Contributing Guidelines.
- [x] Read the docs.
- [x] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [x] Check that this is a concrete bug. For Q&A open a GitHub Discussion.
- [x] The provided reproduction is a minimal reproducible example of the bug.
Provide a based on Playground or CodeSandbox or stackblitz `s MinimalReproducible Example