mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-11-09 13:53:38 +08:00
feat: add Multi-level menu
This commit is contained in:
@@ -1,335 +1,26 @@
|
||||
import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";
|
||||
|
||||
import Layout from "../layout/index.vue";
|
||||
import homeRouter from "./modules/home";
|
||||
import flowChartRouter from "./modules/flowchart";
|
||||
import editorRouter from "./modules/editor";
|
||||
import componentsRouter from "./modules/components";
|
||||
import nestedRouter from "./modules/nested";
|
||||
import systemRouter from "./modules/system";
|
||||
import errorRouter from "./modules/error";
|
||||
import remainingRouter from "./modules/remaining";
|
||||
|
||||
import { storageSession } from "../utils/storage";
|
||||
|
||||
import { i18n } from "/@/plugins/i18n/index";
|
||||
|
||||
const routes: Array<RouteRecordRaw> = [
|
||||
{
|
||||
path: "/",
|
||||
name: "home",
|
||||
component: Layout,
|
||||
redirect: "/welcome",
|
||||
children: [
|
||||
{
|
||||
path: "/welcome",
|
||||
name: "welcome",
|
||||
component: () =>
|
||||
import(/* webpackChunkName: "home" */ "../views/welcome.vue"),
|
||||
meta: {
|
||||
title: "message.hshome",
|
||||
showLink: true,
|
||||
savedPosition: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
meta: {
|
||||
icon: "el-icon-s-home",
|
||||
showLink: true,
|
||||
savedPosition: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/components",
|
||||
name: "components",
|
||||
component: Layout,
|
||||
redirect: "/components/split-pane",
|
||||
children: [
|
||||
{
|
||||
path: "/components/video",
|
||||
component: () =>
|
||||
import(
|
||||
/* webpackChunkName: "components" */ "../views/components/video/index.vue"
|
||||
),
|
||||
meta: {
|
||||
title: "message.hsvideo",
|
||||
showLink: false,
|
||||
savedPosition: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/components/map",
|
||||
component: () =>
|
||||
import(
|
||||
/* webpackChunkName: "components" */ "../views/components/map/index.vue"
|
||||
),
|
||||
meta: {
|
||||
title: "message.hsmap",
|
||||
showLink: false,
|
||||
savedPosition: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/components/draggable",
|
||||
component: () =>
|
||||
import(
|
||||
/* webpackChunkName: "components" */ "../views/components/draggable/index.vue"
|
||||
),
|
||||
meta: {
|
||||
title: "message.hsdraggable",
|
||||
showLink: false,
|
||||
savedPosition: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/components/split-pane",
|
||||
component: () =>
|
||||
import(
|
||||
/* webpackChunkName: "components" */ "../views/components/split-pane/index.vue"
|
||||
),
|
||||
meta: {
|
||||
title: "message.hssplitPane",
|
||||
showLink: false,
|
||||
savedPosition: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/components/button",
|
||||
component: () =>
|
||||
import(
|
||||
/* webpackChunkName: "components" */ "../views/components/button/index.vue"
|
||||
),
|
||||
meta: {
|
||||
title: "message.hsbutton",
|
||||
showLink: false,
|
||||
savedPosition: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/components/cropping",
|
||||
component: () =>
|
||||
import(
|
||||
/* webpackChunkName: "components" */ "../views/components/cropping/index.vue"
|
||||
),
|
||||
meta: {
|
||||
title: "message.hscropping",
|
||||
showLink: false,
|
||||
savedPosition: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/components/countTo",
|
||||
component: () =>
|
||||
import(
|
||||
/* webpackChunkName: "components" */ "../views/components/count-to/index.vue"
|
||||
),
|
||||
meta: {
|
||||
title: "message.hscountTo",
|
||||
showLink: false,
|
||||
savedPosition: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/components/selector",
|
||||
component: () =>
|
||||
import(
|
||||
/* webpackChunkName: "components" */ "../views/components/selector/index.vue"
|
||||
),
|
||||
meta: {
|
||||
title: "message.hsselector",
|
||||
showLink: false,
|
||||
savedPosition: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/components/seamlessScroll",
|
||||
component: () =>
|
||||
import(
|
||||
/* webpackChunkName: "components" */ "../views/components/seamless-scroll/index.vue"
|
||||
),
|
||||
meta: {
|
||||
title: "message.hsseamless",
|
||||
showLink: false,
|
||||
savedPosition: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/components/contextmenu",
|
||||
component: () =>
|
||||
import(
|
||||
/* webpackChunkName: "components" */ "../views/components/contextmenu/index.vue"
|
||||
),
|
||||
meta: {
|
||||
title: "message.hscontextmenu",
|
||||
showLink: false,
|
||||
savedPosition: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
meta: {
|
||||
icon: "el-icon-menu",
|
||||
title: "message.hscomponents",
|
||||
showLink: true,
|
||||
savedPosition: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/flowChart",
|
||||
name: "flowChart",
|
||||
component: Layout,
|
||||
redirect: "/flowChart/index",
|
||||
children: [
|
||||
{
|
||||
path: "/flowChart/index",
|
||||
component: () =>
|
||||
import(
|
||||
/* webpackChunkName: "user" */ "../views/flow-chart/index.vue"
|
||||
),
|
||||
meta: {
|
||||
title: "message.hsflowChart",
|
||||
showLink: false,
|
||||
savedPosition: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
meta: {
|
||||
icon: "el-icon-set-up",
|
||||
title: "message.hsflowChart",
|
||||
showLink: true,
|
||||
savedPosition: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/editor",
|
||||
name: "editor",
|
||||
component: Layout,
|
||||
redirect: "/editor/index",
|
||||
children: [
|
||||
{
|
||||
path: "/editor/index",
|
||||
component: () =>
|
||||
import(/* webpackChunkName: "user" */ "../views/editor/index.vue"),
|
||||
meta: {
|
||||
// icon: 'el-icon-edit-outline',
|
||||
title: "message.hseditor",
|
||||
showLink: false,
|
||||
savedPosition: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
meta: {
|
||||
icon: "el-icon-edit-outline",
|
||||
title: "message.hseditor",
|
||||
showLink: true,
|
||||
savedPosition: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/system",
|
||||
name: "system",
|
||||
component: Layout,
|
||||
redirect: "/system/base",
|
||||
children: [
|
||||
{
|
||||
path: "/system/base",
|
||||
component: () =>
|
||||
import(/* webpackChunkName: "system" */ "../views/system/user.vue"),
|
||||
meta: {
|
||||
// icon: '',
|
||||
title: "message.hsBaseinfo",
|
||||
showLink: false,
|
||||
savedPosition: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/system/dict",
|
||||
component: () =>
|
||||
import(
|
||||
/* webpackChunkName: "system" */ "../views/system/dict/index.vue"
|
||||
),
|
||||
meta: {
|
||||
// icon: '',
|
||||
title: "message.hsDict",
|
||||
showLink: false,
|
||||
savedPosition: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
meta: {
|
||||
icon: "el-icon-setting",
|
||||
title: "message.hssysManagement",
|
||||
showLink: true,
|
||||
savedPosition: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/error",
|
||||
name: "error",
|
||||
component: Layout,
|
||||
redirect: "/error/401",
|
||||
children: [
|
||||
{
|
||||
path: "/error/401",
|
||||
component: () =>
|
||||
import(/* webpackChunkName: "error" */ "../views/error/401.vue"),
|
||||
meta: {
|
||||
title: "message.hsfourZeroOne",
|
||||
showLink: false,
|
||||
savedPosition: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/error/404",
|
||||
component: () =>
|
||||
import(/* webpackChunkName: "error" */ "../views/error/404.vue"),
|
||||
meta: {
|
||||
title: "message.hsfourZeroFour",
|
||||
showLink: false,
|
||||
savedPosition: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
meta: {
|
||||
icon: "el-icon-position",
|
||||
title: "message.hserror",
|
||||
showLink: true,
|
||||
savedPosition: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/login",
|
||||
name: "login",
|
||||
component: () =>
|
||||
import(/* webpackChunkName: "login" */ "../views/login.vue"),
|
||||
meta: {
|
||||
title: "message.hslogin",
|
||||
showLink: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/register",
|
||||
name: "register",
|
||||
component: () =>
|
||||
import(/* webpackChunkName: "register" */ "../views/register.vue"),
|
||||
meta: {
|
||||
title: "message.hsregister",
|
||||
showLink: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
// 找不到路由重定向到404页面
|
||||
path: "/:pathMatch(.*)",
|
||||
component: Layout,
|
||||
redirect: "/error/404",
|
||||
meta: {
|
||||
icon: "el-icon-s-home",
|
||||
title: "message.hshome",
|
||||
showLink: false,
|
||||
savedPosition: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/redirect",
|
||||
component: Layout,
|
||||
children: [
|
||||
{
|
||||
path: "/redirect/:path(.*)",
|
||||
component: () => import("../views/redirect.vue"),
|
||||
},
|
||||
],
|
||||
},
|
||||
homeRouter,
|
||||
flowChartRouter,
|
||||
editorRouter,
|
||||
componentsRouter,
|
||||
nestedRouter,
|
||||
systemRouter,
|
||||
errorRouter,
|
||||
...remainingRouter,
|
||||
];
|
||||
|
||||
const router = createRouter({
|
||||
|
||||
Reference in New Issue
Block a user