El-tree in elementui, data echo problem

when the el-tree related array is returned in the background, the submenus are not all selected, but as long as the id of the parent menu is in the array, then his submenus are all selected

clipboard.png

clipboard.png

method used

this.$axios.get("menu/queryMenuIdList?roleId=" + row.roleId).then(res => {
                   this.defalutArr = res.data
                   this.$refs.tree.setCheckedKeys(this.defalutArr);
                   })

after reading the document, it is said that as long as the included id in the array returned by the setCheckedKey () method is selected, it will be set to the selected state instead of the semi-selected state. Call for help


do not use setCheckedKeys to echo the data. After getting the id array from the back end, use setChecked to cycle through the selected state.
another thing to note is that if using setChecked doesn't work, add a setTimeout to it, or get the data and then process it with a then.


drop the parent id Filter in this.defalutArr


I would like to ask the subject, how to solve the first kind of question you asked? my data is also an array of this kind of data. If there is a parent ID in it, all the children below the parent will be selected. How do you solve it? Thank you so much for waiting online


Hello, how to use setChecked, I didn't respond when I used it.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b395e6-2aecf.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b395e6-2aecf.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?