1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| // show-checkbox 展示复选框 // default-checked-keys 默认选中 // default-expanded-keys 默认展开 // @check-change 监听选中的id ref="tree" // this.$refs.tree.getCheckedKeys().toString() 获取选中的checkbox 将多个id 组成 "1,2,3"这样 // 按钮区别展示 v-if 判断一级type则展示
<el-tree id="left_div" style="width: 300px; overflow-y: auto;" :data="apis" show-checkbox node-key="id" :default-checked-keys="dck" :default-expanded-keys="dek" @check-change="handleCheckChange" ref="tree" > <span class="custom-tree-node" slot-scope="{data}"> <span style="font-size:15px">{{data.label}} </span> <el-button type="text" size="mini" @click="() => set(data)" style="color: #95712d">设置</el-button> <el-button type="text" size="mini" @click="() => add_configure(data)" style="color: #166f1e" v-if="vif(data)">添加</el-button> <el-button type="text" size="mini" @click="() => remove(data)" style="color: darkred">删除</el-button> </span> </el-tree>
|