参考文章:链接 https://www.cnblogs.com/jj123/p/12784100.html
需求:pc后台项目-根据权限动态生成路由
1.generateRoutes.js导出的实例对象,解构后作为new Vuex.Store()的参数对象
2.后台接口返回的路由表数组(即跟前端约定的页面keys) eg.
const list = [
{
"id": 125, "authName": "用户管理", "path": "",
"children": [
{
"id": 110, "authName": "用户列表", "path": "users",
"children": [], "order": null, "component": "users/users"
}
], "order": 1, "component": "home"
},
{
"id": 103, "authName": "权限管理", "path": "",
"children": [
{ "id": 111, "authName": "角色列表", "path": "roles", "children": [], "order": null, "component": "rights/roles" },
{
"id": 112, "authName": "权限列表", "path": "rights",
"children": [], "order": null, "component": "rights/rights"
}],
"order": 2, "component": "home"
}
]