https://www.cnblogs.com/ll15888/p/12098423.html
element ui 獲取tree組件中被選中的節點
<el-tree
:data="data"
show-checkbox
default-expand-all
ref="tree"
node-key="id"
:props="defaultProps"
:default-checked-keys="defaultSelect"
@node-click="handleNodeClick"
>
let res = this.$refs.tree.getCheckedKeys().concat(this.$refs.tree.getHalfCheckedKeys())
console.log(res)
// 全選 getCheckedKeys()
// 半選 getHalfCheckedKeys()
返回結果為數組
// :props="defaultProps" 可以把 data中屬性和 children id等屬性綁定上
賦值給defaultSelect
初始化默認高亮