:unique-opened="true" 只保留一个菜单
:router="true"开启路由标识
index="users" 是标识 它就会去找这个路由
<el-menu
default-active="2"
:router="true"
:unique-opened="true"
class="el-menu-vertical-demo"
@open="handleOpen"
@close="handleClose"
background-color="#d3dce6"
text-color="#fff"
active-text-color="#ffd04b"
>
标识
<el-menu-item-group>
<el-menu-item index="users">用户列表</el-menu-item>
<el-menu-item index="1-2">选项2</el-menu-item>
</el-menu-item-group>
路由
{
path: "/home",
name: "home",
component: () => import("../components/home/home.vue"),
children: [
{
path: "/users",
name: "users",
component: () => import("../components/users/users.vue")
}
]
}