You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
978 B
49 lines
978 B
// 模拟后端动态生成路由
|
|
import { MockMethod } from "vite-plugin-mock";
|
|
|
|
/**
|
|
* roles:页面级别权限,这里模拟二种 "admin"、"common"
|
|
* admin:管理员角色
|
|
* common:普通角色
|
|
*/
|
|
|
|
const permissionRouter = {
|
|
path: "/permission",
|
|
meta: {
|
|
title: "menus.permission",
|
|
icon: "lollipop",
|
|
rank: 10
|
|
},
|
|
children: [
|
|
{
|
|
path: "/permission/page/index",
|
|
name: "PermissionPage",
|
|
meta: {
|
|
roles: ["admin", "common"],
|
|
title: "menus.permissionPage"
|
|
}
|
|
},
|
|
{
|
|
path: "/permission/button/index",
|
|
name: "PermissionButton",
|
|
meta: {
|
|
title: "menus.permissionButton",
|
|
roles: ["admin", "common"],
|
|
auths: ["btn_add", "btn_edit", "btn_delete"]
|
|
}
|
|
}
|
|
]
|
|
};
|
|
|
|
export default [
|
|
{
|
|
url: "/getAsyncRoutes",
|
|
method: "get",
|
|
response: () => {
|
|
return {
|
|
success: true,
|
|
data: [permissionRouter]
|
|
};
|
|
}
|
|
}
|
|
] as MockMethod[];
|