<template>
<div>
<el-tree
:data="list"
show-checkbox
default-expand-all
node-key="id" //对应返回对象的id,同时也对应回显需要的id,名称要一致
ref="tree"
highlight-current
:props="defaultProps">
</el-tree>
<div class="buttons">
<el-button @click="getCheckedNodes">获取</el-button>
<el-button @click="resetChecked">清空</el-button>
</div>
</div>
</template>
<script>
export default {
data() {
return {
list: [{
parentId: 0,
path: '',
auth_id: 1,
label: '一级菜单',
children: [
{
parentId: 1,
path: '',
auth_id: 101,
label: '二级菜单(一)',
children: [{
vue树形菜单简单实例
最新推荐文章于 2023-11-22 15:54:42 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)