zhangzengfei
2021-11-17 5186227a467bd34dc253e64b23bc96d3a07bb399
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import Vue from "vue";
import VueRouter from "vue-router";
import Layout from "@/layouts";
import { publicPath, routerMode } from "@/config";
 
Vue.use(VueRouter);
export const constantRoutes = [
  {
    path: "/login",
    component: () => import("@/views/login/index"),
    hidden: true,
  },
  {
    path: "/401",
    name: "401",
    component: () => import("@/views/401"),
    hidden: true,
  },
  {
    path: "/404",
    name: "404",
    component: () => import("@/views/404"),
    hidden: true,
  },
];
 
export const asyncRoutes = [
  {
    path: "/",
    component: Layout,
    redirect: "/index",
    children: [
      {
        path: "index",
        name: "Index",
        component: () => import("@/views/index/index"),
        meta: {
          title: "首页",
          icon: "home",
          affix: true,
        },
      },
    ],
  },
 
  {
    path: "/project",
    component: Layout,
    redirect: "project",
    // name: 'Vab',
    // alwaysShow: true,
    children: [
      {
        path: "index",
        component: () => import("@/views/project/index"),
        name: "Project",
        meta: {
          title: "项目",
          icon: "box-open",
          affix: true,
        },
      },
    ],
  },
 
  {
    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,
  mode: routerMode,
  scrollBehavior: () => ({
    y: 0,
  }),
  routes: constantRoutes,
});
 
export function resetRouter() {
  location.reload();
}
 
export default router;