先看图:
代码如下:
// 全部选中 qxClick() { this.isQx = !this.isQx; // 判断按钮的状态 this.expandAll(); if (this.isQx) { console.log(this.isQx, "-------------------------------", this.datas); // 设置 this.$refs.treeForm_mxs.setCheckedNodes(this.datas); for ( var i = 0; i < this.$refs.treeForm_mxs.getCheckedNodes().length; i++ ) {} } else { this.$refs.treeForm_mxs.setCheckedNodes([]); } }, // 全部展开 expandAll() { if (this.isQx) { for (var i in this.$refs.treeForm_mxs.store.nodesMap) { this.$refs.treeForm_mxs.store.nodesMap[i].expanded = true; } } else { for (var j in this.$refs.treeForm_mxs.store.nodesMap) { this.$refs.treeForm_mxs.store.nodesMap[j].expanded = false; } } },
datas:
标签:el,treeForm,isQx,refs,tree,mxs,全选,store From: https://www.cnblogs.com/a973692898/p/17526207.html