从后台动态获取菜单栏
一、菜单栏代码
推荐观看视频进行学习:https://www.bilibili.com/video/BV1zy4y147iX?p=7
{{item.perm_name}}
{{item3.perm_name}}
{{item.perm_name}}
二、代码解释
1.
element-ui官网中有对导航栏属性的解释
:default-active="activePath"
class="el-menu-vertical-demo"
background-color="#545c64"
text-color="#fff"
active-text-color="#ffd04b"
:unique-opened="true"
:router="true"
:collapse="isCollapse"
:collapse-transition="false"
2.
代码中item.id+''是为了解决以下报错,index应该使用字符串
三、传递参数给后台接口
自行创建一个专门写连接后台接口的js文件
// 获取菜单栏
export function getlist(params) {
return axios.get('/xxxx/xxxx', { params });
}