html
<div align="left"> <el-checkbox v-model="checked" @change="checked"/> 全选/反选 </div> <el-tree :data="data1" ref="vuetree" show-checkbox node-key="cityCode" :props="defaultProps" @check-change="getcode" > </el-tree>
js
checked() { // 机构全选事件 if (this.checked) { // 全选 this.$refs.vuetree.setCheckedNodes(this.data1) } else { // 取消选中 this.$refs.vuetree.setCheckedKeys([]) } },
vue+element el-tree实现点击全选或者反选渲染数据
原文:https://www.cnblogs.com/2001-/p/13657163.html