how to get the ID? of the parent node when clicking on the node The event of the parent node is not specifically obtained in the official website api. The current click data can be obtained by binding the getNode method, but storing the ID of the parent node is mostly said on the Internet to operate by changing the source code, but the project online source code submission is another problem, is there a better solution?
<el-tree ref="tree" :data="privilegeList" show-checkbox node-key="id" :default-checked-keys="jurisdictionId" :default-expand-all="true" :props="defaultProps" @check-change="getNode">
</el-tree>
methods: {
// ID, ID
getNode(data) {
console.log("data", data.id);
},
// data
getJurisdictionZtree() {
this.$http.get(this.$api.privilege).then(res => {
this.privilegeList = res.data.data.privilegeList;
console.log("data", this.privilegeList);
});
}
}
when the first picture is clicked to add, the following print corresponds to the parent node ID of the first image. The current click ID, cannot be stored through an empty array, but can only be stored
. The third picture is the data obtained from the data