<el-tree
:data="treeData"// Bind array show-checkbox // whether to display checkboxes :default-checked-keys="check"// The default selected value is an array of each valueid
node-key="id"/ / bindingidThe key... ref="tree"// Many methods need to declare red first... highlight-current :props="defaultProps"
@check="currentChecked"// Listen for click events
>
</el-tree>
data(){
retuen{
defaultProps: {
children: "children",
label: "label",
},
check:[],
roleData:' '}} methods: {currentChecked (nodeObj, SelectedObj) {// console.log(SelectedObj, SelectedObj, SelectedObj)'ttt')
// console.log(SelectedObj.checkedKeys,'pppp') // This is the key array of the selected node. Uncheck one of the check boxes under the child node does not return the parent nodeid
// console.log(SelectedObj.checkedNodes,'oooo') // This is the selected node array letid= this. $refs. Tree. GetHalfCheckedKeys (). The concat (this. $refs. Tree. GetCheckedKeys ()) / / check and uncheck all returned to the parent nodeid
this.check = SelectedObj.checkedKeys
this.sysRoleUpdateCheck(id)
console.log(id ,'this.$refs.tree.getCheckedKeys()')}},Copy the code