🐛(component): update

This commit is contained in:
就眠儀式 2022-10-03 06:47:02 +08:00
parent 85b14ba7e4
commit 8d19e433a7
2 changed files with 19 additions and 8 deletions

View File

@ -133,15 +133,26 @@ class Tree {
return node;
}
treeForeach (tree: any, func: Function) {
tree.forEach((data: any) => {
data.children && this.treeForeach(data.children, func) // 遍历子树
func(data)
})
}
setChildrenChecked(checked: boolean, nodes: TreeData[]) {
var ableCount = 0;
var checkCount = 0;
const len = nodes.length;
/**
* , , ,
*
* , ,
*
* ,
*/
this.treeForeach(nodes ,(node: any) => {
if(!node.isDisabled) {
ableCount = ableCount + 1;
if(node.isChecked) {
checkCount = checkCount + 1;
}
}
})
checkCount < ableCount ? checked = true : checked = false;
for (let i = 0; i < len; i++) {
if(!nodes[i].isDisabled || (nodes[i].isDisabled && nodes[i].children.length > 0)) {
nodes[i].isChecked = checked;

View File

@ -43,7 +43,7 @@
rel="nofollow"
class="site-star"
>
<i class="layui-icon"></i> Star <cite id="getStars">1514</cite>
<i class="layui-icon"></i> Star <cite id="getStars">1576</cite>
</a>
<a
href="https://gitee.com/layui-vue"