using the element tree table component, displaying the data is different from what you think.
json
this click shows the data table, but it does not show the options that are checked by default according to the logic I wrote.
user modules should all be checked by default, because flag is true, and when flag is true, it is checked, and it is not checked when it is false, but
setCheckedNodes(row) {
this.roleId = row.id;
RoleList({
roleId: this.roleId
})
.then(res => {
this.dialogFormVisible = true;
if (res.code == 0) {
this.$refs.tree.setCheckedNodes([{flag:true}]);
this.roleStree = res.data;
}
})
.catch(err => {});
},
Logic
<el-tree
:data="roleStree"
show-checkbox
node-key="id"
highlight-current
default-expand-all
ref="tree"
:props="defaultProps"
></el-tree>
here I quote an official example
Why didn"t it work? The official method used here does not show the effect I want