HTML:
<el-tree :data="treedata" :default-expand-all="isExpandAll" :indent="50" :check-strictly="false" show-checkbox node-key="id" :key="Math.random()" ref="tree" highlight-current :props="defaultProps"> </el-tree>
提交:
console.log("保存树权限数组:"," 勾选项的数组 ",this.$refs.tree.getCheckedKeys(),' 带半勾选项的数组 ',this.$refs.tree.getHalfCheckedNodes().concat(this.$refs.tree.getCheckedNodes()))
回显设置:
for(var i in this.treecheck){ this.$refs.tree.setChecked(this.treecheck[i],true,false);//通过setChecked()方法回显 }