接上篇文章需求,选择树形结构的时候有多选的情况,用上一篇的单选并不能解决问题,下图是这次达到的效果
话不多说,上代码
html
<el-select v-model="value" multiple placeholder="请选择" :popper-append-to-body="false">
<el-option :value="selectTree" class="setstyle" disabled>
<el-tree :data="list" :props="defaultProps" ref="tree"
show-checkbox check-strictly :expand-on-click-node="false"
check-on-click-node @check-change="handleNodeClick"></el-tree>
</el-option>
</el-select>
js
<script>
export default {
data() {
return {
value:[],
selectTree:[],
defaultProps:{
children: 'children',
label: 'label'
},
list: [{
id: 1,
label