| | |
| | | import Vue from 'vue' |
| | | import VueRouter from 'vue-router' |
| | | import Layout from '@/layouts' |
| | | import { publicPath, routerMode } from '@/config' |
| | | import Vue from "vue"; |
| | | import VueRouter from "vue-router"; |
| | | import Layout from "@/layouts"; |
| | | import { publicPath, routerMode } from "@/config"; |
| | | |
| | | Vue.use(VueRouter) |
| | | Vue.use(VueRouter); |
| | | export const constantRoutes = [ |
| | | { |
| | | path: '/login', |
| | | component: () => import('@/views/login/index'), |
| | | path: "/login", |
| | | component: () => import("@/views/login/index"), |
| | | hidden: true, |
| | | }, |
| | | { |
| | | path: '/401', |
| | | name: '401', |
| | | component: () => import('@/views/401'), |
| | | path: "/401", |
| | | name: "401", |
| | | component: () => import("@/views/401"), |
| | | hidden: true, |
| | | }, |
| | | { |
| | | path: '/404', |
| | | name: '404', |
| | | component: () => import('@/views/404'), |
| | | path: "/404", |
| | | name: "404", |
| | | component: () => import("@/views/404"), |
| | | hidden: true, |
| | | }, |
| | | ] |
| | | ]; |
| | | |
| | | export const asyncRoutes = [ |
| | | { |
| | | path: '/', |
| | | path: "/", |
| | | component: Layout, |
| | | redirect: '/index', |
| | | redirect: "/index", |
| | | children: [ |
| | | { |
| | | path: 'index', |
| | | name: 'Index', |
| | | component: () => import('@/views/index/index'), |
| | | path: "index", |
| | | name: "Index", |
| | | component: () => import("@/views/index/index"), |
| | | meta: { |
| | | title: '首页', |
| | | icon: 'home', |
| | | title: "首页", |
| | | icon: "home", |
| | | affix: true, |
| | | }, |
| | | }, |
| | |
| | | }, |
| | | |
| | | { |
| | | path: '/project', |
| | | path: "/project", |
| | | component: Layout, |
| | | redirect: 'project', |
| | | redirect: "project", |
| | | // name: 'Vab', |
| | | // alwaysShow: true, |
| | | children: [ |
| | | { |
| | | path: 'index', |
| | | component: () => import('@/views/project/index'), |
| | | name: 'Project', |
| | | path: "index", |
| | | component: () => import("@/views/project/index"), |
| | | name: "Project", |
| | | meta: { |
| | | title: '项目', |
| | | icon: 'box-open', |
| | | permissions: ['admin'], |
| | | title: "项目", |
| | | icon: "box-open", |
| | | affix: true, |
| | | }, |
| | | }, |
| | | ], |
| | | }, |
| | | |
| | | { |
| | | path: '*', |
| | | redirect: '/404', |
| | | path: "/user", |
| | | component: Layout, |
| | | redirect: "user", |
| | | // name: 'Vab', |
| | | // alwaysShow: true, |
| | | children: [ |
| | | { |
| | | path: "index", |
| | | component: () => import("@/views/user/index"), |
| | | name: "User", |
| | | meta: { |
| | | title: "用户", |
| | | icon: "user", |
| | | permissions: ["admin"], |
| | | }, |
| | | }, |
| | | ], |
| | | meta: { permissions: ["admin"] }, |
| | | }, |
| | | |
| | | { |
| | | path: "*", |
| | | redirect: "/404", |
| | | hidden: true, |
| | | }, |
| | | ] |
| | | ]; |
| | | |
| | | const router = new VueRouter({ |
| | | base: publicPath, |
| | |
| | | y: 0, |
| | | }), |
| | | routes: constantRoutes, |
| | | }) |
| | | }); |
| | | |
| | | export function resetRouter() { |
| | | location.reload() |
| | | location.reload(); |
| | | } |
| | | |
| | | export default router |
| | | export default router; |