mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-11-03 13:44:47 +08:00
feat: 模拟后台返回不同角色路由生成动态路由
This commit is contained in:
52
mock/asyncRoutes.ts
Normal file
52
mock/asyncRoutes.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
// 根据角色动态生成路由
|
||||
import { MockMethod } from "vite-plugin-mock";
|
||||
|
||||
// http://mockjs.com/examples.html#Object
|
||||
const systemRouter = {
|
||||
path: "/system",
|
||||
name: "system",
|
||||
// component: Layout,
|
||||
redirect: "/system/user",
|
||||
meta: {
|
||||
icon: "el-icon-setting",
|
||||
title: "message.hssysManagement",
|
||||
showLink: true,
|
||||
savedPosition: true,
|
||||
rank: 6,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/system/user",
|
||||
name: "user",
|
||||
// component: () => import("/@/views/system/user/index.vue"),
|
||||
meta: {
|
||||
title: "message.hsBaseinfo",
|
||||
showLink: false,
|
||||
savedPosition: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/system/dict",
|
||||
name: "dict",
|
||||
// component: () => import("/@/views/system/dict/index.vue"),
|
||||
meta: {
|
||||
title: "message.hsDict",
|
||||
showLink: false,
|
||||
savedPosition: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default [
|
||||
{
|
||||
url: "/getAsyncRoutes",
|
||||
method: "get",
|
||||
response: () => {
|
||||
return {
|
||||
code: 0,
|
||||
info: systemRouter,
|
||||
};
|
||||
},
|
||||
},
|
||||
] as MockMethod[];
|
||||
Reference in New Issue
Block a user