daidaibg
2022-10-10 a44105de2e57b676280f175237e3f2e2c017db6a
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
import type { RouteRecordRaw } from "vue-router";
import { createRouter, createWebHistory } from "vue-router";
import NProgress from "nprogress";
 
const routes: RouteRecordRaw[] = [
  {
    path: "/",
    component: () => import("~/views/home/index.vue"),
  },
  {
    path: "/404",
    name: "ErrorPage",
    component: () => import("~/views/errorPages/index.vue"),
  },
  {
    path: "/home",
    name: "Home",
    component: () => import("~/views/home/index.vue"),
  },
  {
    path: "/hero",
    name: "Hero",
    component: () => import("~/views/home/components/Hero.vue"),
  },
  {
    path: "/StoreTest",
    name: "StoreTest",
    component: () => import("~/views/home/components/StoreTest.vue"),
  },
  {
    path: "/:pathMatch(.*)*",
    redirect: "/404",
  },
];
 
const index = createRouter({
  history: createWebHistory(),
  routes,
});
index.beforeEach(() => {
  if (!NProgress.isStarted())
    NProgress.start();
});
 
index.afterEach(() => {
  NProgress.done();
});
 
export default index;