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()方法回顯 }