Tree 树形控件 全选
作者:chrispy
<div class="cleckedTree"> <el-button type="primary" @click="handleDeliveryRegionCheckAll">全选</el-button> <el-button type="danger" @click="handleDeliveryRegionCheck"
<div class="cleckedTree">
<el-button type="primary" @click="handleDeliveryRegionCheckAll">全选</el-button>
<el-button type="danger" @click="handleDeliveryRegionCheck">清除选择</el-button>
</div>
<el-tree ref='tree' :data="data" :default-expand-all="true" :default-checked-keys="defaultCheckedKeys" show-checkbox node-key="id" :default-expanded-keys="defaultExpandedKeys" :props="defaultProps"></el-tree>
data () {
result {
data: [] // 全部树形结构id
}
}
// 房间 全选
handleDeliveryRegionCheckAll () {
this.$refs.tree.setCheckedNodes(this.data)
},
// 房间 取消全选
handleDeliveryRegionCheck () {
this.$refs.tree.setCheckedNodes([])
},