Element-ui中tree树形控件取消选中的功能实现

<el-tree 
:data="vuetree" 
ref="vuetree" 
node-key="code" 
default-expand-all 
:props="defaultProps">

data里面的内容

vuetree: [],  //存放树形组件的data
checked:false, //checkbox的值
defaultProps: {
	children: 'children',
	label: 'name'
},

方法

/取消选中
            this.$refs.vuetree.setCheckedKeys([]);

注意

使用setCheckedKeys()方法在el-tree 中一定要有node-key,每个节点node-key是唯一的属性

猜你喜欢

转载自blog.csdn.net/weixin_60196946/article/details/131931326