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:
@@ -5,9 +5,17 @@ const componentsRouter = {
|
||||
name: "components",
|
||||
component: Layout,
|
||||
redirect: "/components/split-pane",
|
||||
meta: {
|
||||
icon: "el-icon-menu",
|
||||
title: "message.hscomponents",
|
||||
showLink: true,
|
||||
savedPosition: true,
|
||||
rank: 4,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/components/video",
|
||||
name: "video",
|
||||
component: () => import("/@/views/components/video/index.vue"),
|
||||
meta: {
|
||||
title: "message.hsvideo",
|
||||
@@ -17,6 +25,7 @@ const componentsRouter = {
|
||||
},
|
||||
{
|
||||
path: "/components/map",
|
||||
name: "map",
|
||||
component: () => import("/@/views/components/map/index.vue"),
|
||||
meta: {
|
||||
title: "message.hsmap",
|
||||
@@ -26,6 +35,7 @@ const componentsRouter = {
|
||||
},
|
||||
{
|
||||
path: "/components/draggable",
|
||||
name: "draggable",
|
||||
component: () => import("/@/views/components/draggable/index.vue"),
|
||||
meta: {
|
||||
title: "message.hsdraggable",
|
||||
@@ -33,8 +43,10 @@ const componentsRouter = {
|
||||
savedPosition: true,
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
path: "/components/split-pane",
|
||||
path: "/components/splitPane",
|
||||
name: "splitPane",
|
||||
component: () => import("/@/views/components/split-pane/index.vue"),
|
||||
meta: {
|
||||
title: "message.hssplitPane",
|
||||
@@ -44,6 +56,7 @@ const componentsRouter = {
|
||||
},
|
||||
{
|
||||
path: "/components/button",
|
||||
name: "button",
|
||||
component: () => import("/@/views/components/button/index.vue"),
|
||||
meta: {
|
||||
title: "message.hsbutton",
|
||||
@@ -53,6 +66,7 @@ const componentsRouter = {
|
||||
},
|
||||
{
|
||||
path: "/components/cropping",
|
||||
name: "cropping",
|
||||
component: () => import("/@/views/components/cropping/index.vue"),
|
||||
meta: {
|
||||
title: "message.hscropping",
|
||||
@@ -62,6 +76,7 @@ const componentsRouter = {
|
||||
},
|
||||
{
|
||||
path: "/components/countTo",
|
||||
name: "countTo",
|
||||
component: () => import("/@/views/components/count-to/index.vue"),
|
||||
meta: {
|
||||
title: "message.hscountTo",
|
||||
@@ -71,6 +86,7 @@ const componentsRouter = {
|
||||
},
|
||||
{
|
||||
path: "/components/selector",
|
||||
name: "selector",
|
||||
component: () => import("/@/views/components/selector/index.vue"),
|
||||
meta: {
|
||||
title: "message.hsselector",
|
||||
@@ -80,6 +96,7 @@ const componentsRouter = {
|
||||
},
|
||||
{
|
||||
path: "/components/seamlessScroll",
|
||||
name: "seamlessScroll",
|
||||
component: () => import("/@/views/components/seamless-scroll/index.vue"),
|
||||
meta: {
|
||||
title: "message.hsseamless",
|
||||
@@ -89,6 +106,7 @@ const componentsRouter = {
|
||||
},
|
||||
{
|
||||
path: "/components/contextmenu",
|
||||
name: "contextmenu",
|
||||
component: () => import("/@/views/components/contextmenu/index.vue"),
|
||||
meta: {
|
||||
title: "message.hscontextmenu",
|
||||
@@ -97,12 +115,6 @@ const componentsRouter = {
|
||||
},
|
||||
},
|
||||
],
|
||||
meta: {
|
||||
icon: "el-icon-menu",
|
||||
title: "message.hscomponents",
|
||||
showLink: true,
|
||||
savedPosition: true,
|
||||
},
|
||||
};
|
||||
|
||||
export default componentsRouter;
|
||||
|
||||
@@ -5,9 +5,17 @@ const editorRouter = {
|
||||
name: "editor",
|
||||
component: Layout,
|
||||
redirect: "/editor/index",
|
||||
meta: {
|
||||
icon: "el-icon-edit-outline",
|
||||
title: "message.hseditor",
|
||||
showLink: true,
|
||||
savedPosition: true,
|
||||
rank: 2,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/editor/index",
|
||||
name: "editor",
|
||||
component: () => import("/@/views/editor/index.vue"),
|
||||
meta: {
|
||||
title: "message.hseditor",
|
||||
@@ -16,12 +24,6 @@ const editorRouter = {
|
||||
},
|
||||
},
|
||||
],
|
||||
meta: {
|
||||
icon: "el-icon-edit-outline",
|
||||
title: "message.hseditor",
|
||||
showLink: true,
|
||||
savedPosition: true,
|
||||
},
|
||||
};
|
||||
|
||||
export default editorRouter;
|
||||
|
||||
@@ -5,9 +5,17 @@ const errorRouter = {
|
||||
name: "error",
|
||||
component: Layout,
|
||||
redirect: "/error/401",
|
||||
meta: {
|
||||
icon: "el-icon-position",
|
||||
title: "message.hserror",
|
||||
showLink: true,
|
||||
savedPosition: true,
|
||||
rank: 7,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/error/401",
|
||||
name: "401",
|
||||
component: () => import("/@/views/error/401.vue"),
|
||||
meta: {
|
||||
title: "message.hsfourZeroOne",
|
||||
@@ -17,6 +25,7 @@ const errorRouter = {
|
||||
},
|
||||
{
|
||||
path: "/error/404",
|
||||
name: "404",
|
||||
component: () => import("/@/views/error/404.vue"),
|
||||
meta: {
|
||||
title: "message.hsfourZeroFour",
|
||||
@@ -25,12 +34,6 @@ const errorRouter = {
|
||||
},
|
||||
},
|
||||
],
|
||||
meta: {
|
||||
icon: "el-icon-position",
|
||||
title: "message.hserror",
|
||||
showLink: true,
|
||||
savedPosition: true,
|
||||
},
|
||||
};
|
||||
|
||||
export default errorRouter;
|
||||
|
||||
@@ -5,9 +5,17 @@ const flowChartRouter = {
|
||||
name: "flowChart",
|
||||
component: Layout,
|
||||
redirect: "/flowChart/index",
|
||||
meta: {
|
||||
icon: "el-icon-set-up",
|
||||
title: "message.hsflowChart",
|
||||
showLink: true,
|
||||
savedPosition: true,
|
||||
rank: 1,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/flowChart/index",
|
||||
name: "flowChart",
|
||||
component: () => import("/@/views/flow-chart/index.vue"),
|
||||
meta: {
|
||||
title: "message.hsflowChart",
|
||||
@@ -16,12 +24,6 @@ const flowChartRouter = {
|
||||
},
|
||||
},
|
||||
],
|
||||
meta: {
|
||||
icon: "el-icon-set-up",
|
||||
title: "message.hsflowChart",
|
||||
showLink: true,
|
||||
savedPosition: true,
|
||||
},
|
||||
};
|
||||
|
||||
export default flowChartRouter;
|
||||
|
||||
@@ -5,6 +5,12 @@ const homeRouter = {
|
||||
name: "home",
|
||||
component: Layout,
|
||||
redirect: "/welcome",
|
||||
meta: {
|
||||
icon: "el-icon-s-home",
|
||||
showLink: true,
|
||||
savedPosition: false,
|
||||
rank: 0,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/welcome",
|
||||
@@ -17,11 +23,6 @@ const homeRouter = {
|
||||
},
|
||||
},
|
||||
],
|
||||
meta: {
|
||||
icon: "el-icon-s-home",
|
||||
showLink: true,
|
||||
savedPosition: false,
|
||||
},
|
||||
};
|
||||
|
||||
export default homeRouter;
|
||||
|
||||
@@ -10,6 +10,7 @@ const nestedRouter = {
|
||||
icon: "el-icon-s-data",
|
||||
showLink: true,
|
||||
savedPosition: false,
|
||||
rank: 5,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
||||
39
src/router/modules/permission.ts
Normal file
39
src/router/modules/permission.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import Layout from "/@/layout/index.vue";
|
||||
|
||||
const permissionRouter = {
|
||||
path: "/permission",
|
||||
component: Layout,
|
||||
redirect: "/permission/page",
|
||||
name: "permission",
|
||||
meta: {
|
||||
title: "message.permission",
|
||||
icon: "el-icon-lollipop",
|
||||
showLink: true,
|
||||
savedPosition: false,
|
||||
rank: 3,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/permission/page",
|
||||
component: () => import("/@/views/permission/page.vue"),
|
||||
name: "permissionPage",
|
||||
meta: {
|
||||
title: "message.permissionPage",
|
||||
showLink: true,
|
||||
savedPosition: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/permission/button",
|
||||
component: () => import("/@/views/permission/button.vue"),
|
||||
name: "permissionButton",
|
||||
meta: {
|
||||
title: "message.permissionButton",
|
||||
showLink: true,
|
||||
savedPosition: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default permissionRouter;
|
||||
@@ -8,6 +8,7 @@ const remainingRouter = [
|
||||
meta: {
|
||||
title: "message.hslogin",
|
||||
showLink: false,
|
||||
rank: 101,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -17,11 +18,13 @@ const remainingRouter = [
|
||||
meta: {
|
||||
title: "message.hsregister",
|
||||
showLink: false,
|
||||
rank: 102,
|
||||
},
|
||||
},
|
||||
{
|
||||
// 找不到路由重定向到404页面
|
||||
path: "/:pathMatch(.*)",
|
||||
name: "pathMatch",
|
||||
component: Layout,
|
||||
redirect: "/error/404",
|
||||
meta: {
|
||||
@@ -29,14 +32,24 @@ const remainingRouter = [
|
||||
title: "message.hshome",
|
||||
showLink: false,
|
||||
savedPosition: false,
|
||||
rank: 103,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/redirect",
|
||||
name: "redirect",
|
||||
component: Layout,
|
||||
meta: {
|
||||
icon: "el-icon-s-home",
|
||||
title: "message.hshome",
|
||||
showLink: false,
|
||||
savedPosition: false,
|
||||
rank: 104,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/redirect/:path(.*)",
|
||||
name: "redirect",
|
||||
component: () => import("/@/views/redirect.vue"),
|
||||
},
|
||||
],
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
import Layout from "/@/layout/index.vue";
|
||||
|
||||
const systemRouter = {
|
||||
path: "/system",
|
||||
name: "system",
|
||||
component: Layout,
|
||||
redirect: "/system/base",
|
||||
children: [
|
||||
{
|
||||
path: "/system/base",
|
||||
component: () => import("/@/views/system/user.vue"),
|
||||
meta: {
|
||||
title: "message.hsBaseinfo",
|
||||
showLink: false,
|
||||
savedPosition: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/system/dict",
|
||||
component: () => import("/@/views/system/dict/index.vue"),
|
||||
meta: {
|
||||
title: "message.hsDict",
|
||||
showLink: false,
|
||||
savedPosition: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
meta: {
|
||||
icon: "el-icon-setting",
|
||||
title: "message.hssysManagement",
|
||||
showLink: true,
|
||||
savedPosition: true,
|
||||
},
|
||||
};
|
||||
|
||||
export default systemRouter;
|
||||
Reference in New Issue
Block a user