作者:咾爺們 | 来源:互联网 | 2023-08-12 10:18
"treedatalist" show-
checkbox default-expand-
all :check-strictly=
"true" node-key=
"id" ref="tree" :default-checked-keys="mycheckedkeys" @check-change="handleCheckChange" :render-cOntent="renderContent">
:props="defaultProps">
method:{
renderContent (h, { node, data, store }) {
return (
<span class="custom-tree-node">
<span>{node.label} span>
<span>
<el-button size="mini" type="text" icon="el-icon-delete" on-click={() => this.remove(node, data)}>el-button>
<el-button size="mini" type="text" icon="el-icon-edit" on-click={() => this.edit(node, data)}>el-button>
span>
span>);
},
}
:check-strictly="true" 选择父节点时子节点不会被一起选中
:default-checked-keys="mycheckedkeys" 设置默认选中的节点
this.$refs.tree.getCheckedKeys() 获取被选中节点的id
:render-cOntent="renderContent"> 渲染el-tree renderContent增加删除、编辑节点的按钮