meta:{
grade:[1,2,3], //权限等级
title:'页面标题',
icon:'图标',
show:'是否展示导航'
}
let routes = [
{
path: '/login',
name: 'login',
component: () => import('../components/login/login.vue')
},
// 404
{
path: '/404',
alias: '*',
meta: {
grade: [1, 2]
},
component: () => import("../components/404.vue")
}
];
let router = new Router({
routes,
mode: "history"
})
function addRoutes(data) {
for (let i = 0; i < data.length; i++) {
router.addRoute(data[i])
}
}