If the element-ui tree component of vue is not fully selected, the node-key of the parent node will not be put into the bound array


                            <el-tree
                                ref="roleTree"
                                :data="treeList"
                                show-checkbox
                                node-key="MENU_ID"
                                :default-checked-keys="rolesVal"
                                :props="props"
                                @check-change="handleCheckChange">
                            </el-tree>

clipboard.png
now I need to pass the MENU_ID of the parent node managed by the system to the backend. What to do? if it is not all selected by default, if the child node is passed directly, only if all is selected, the ID of the parent node will be passed. The official document is confused

.
Mar.28,2021

this.$refs.tree2.getCheckedKeys (). Concat (this.$refs.tree2.getHalfCheckedKeys ()) is fine. You don't need to change anything


 node_modules/element-ui/lib/element-ui.common.js
TreeStore.prototype.getCheckedKeysifnode.checked
if (node.checked||node.indeterminate)

to get the selected and semi-selected buttons id

Menu