We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
衷心的希望能提供获取半选节点的api, 如果我不点击节点触发事件我就拿不到halfCheckedKeys。很多时候一个界面会有多个tree,在保持父子节点联动的特性的同时我需要在初始化后不操作a-tree组件 就可以直接获取halfCheckedKeys 。后端会将半选节点和全选节点的key一起返回给我,因此必须每次都手动分离。
ant-design-vue:1.7.4 下面是我手动筛选节点的方法:贴上来只是想说自己有思考过,但是更期望有更好的解决办法。我自己也看了源码,无奈功力不够 有些无从下手。。。
//userData为一个含有 半选/全选节点 key的数组 function getAllKeys(treeData, userData) { let checkedKeys = []; let halfCheckedKeys = []; function testNode(node) { function isfullChecked(node) { if (node?.children?.length) { return node.children.every(res => userData.includes(res.key) && (res?.children?.length ? isfullChecked(res.children) : true)); } return true } isfullChecked(node) ? checkedKeys.push(node.key) : halfCheckedKeys.push(node.key); } function divideNode(tree) { tree.forEach(node => { if (userData.includes(node.key)) { testNode(node); } if (node?.children?.length) { divideNode(node.children) }`` }) } divideNode(treeData); return { checkedKeys, halfCheckedKeys } }
The text was updated successfully, but these errors were encountered:
fbd9a21
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Sorry, something went wrong.
No branches or pull requests
What problem does this feature solve?
衷心的希望能提供获取半选节点的api, 如果我不点击节点触发事件我就拿不到halfCheckedKeys。很多时候一个界面会有多个tree,在保持父子节点联动的特性的同时我需要在初始化后不操作a-tree组件 就可以直接获取halfCheckedKeys 。后端会将半选节点和全选节点的key一起返回给我,因此必须每次都手动分离。
What does the proposed API look like?
ant-design-vue:1.7.4
下面是我手动筛选节点的方法:贴上来只是想说自己有思考过,但是更期望有更好的解决办法。我自己也看了源码,无奈功力不够 有些无从下手。。。
The text was updated successfully, but these errors were encountered: