From b2ef7fa10a2faeeafdab8d94d8fa0a02a7dab360 Mon Sep 17 00:00:00 2001
From: ZhangXianQiang <1135831638@qq.com>
Date: 星期五, 08 三月 2024 17:57:41 +0800
Subject: [PATCH] fix:修改实例获取
---
src/router/index.ts | 71 +++++++++++++++--------------------
1 files changed, 31 insertions(+), 40 deletions(-)
diff --git a/src/router/index.ts b/src/router/index.ts
index d5f8849..5e4c968 100644
--- a/src/router/index.ts
+++ b/src/router/index.ts
@@ -1,49 +1,40 @@
-import type { RouteRecordRaw } from "vue-router";
-import { createRouter, createWebHistory } from "vue-router";
-import NProgress from "nprogress";
-
-const routes: RouteRecordRaw[] = [
+import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'
+import type {RouteRecordRaw} from "vue-router"
+const routes: Array<RouteRecordRaw> = [
{
- path: "/",
- component: () => import("~/views/home/index.vue"),
+ path: '/',
+ redirect: '/login',
},
{
- path: "/404",
- name: "ErrorPage",
- component: () => import("~/views/errorPages/index.vue"),
+ path: '/login',
+ name: 'login',
+ component: () => import('@/views/login.vue'),
},
{
- path: "/home",
- name: "Home",
- component: () => import("~/views/home/index.vue"),
+ path: '/home',
+ name: 'home',
+ component: () => import('@/views/HomeView.vue'),
+ children:[
+ {
+ path: '/index',
+ name: 'index',
+ component: () => import('@/views/index/index.vue'),
+ },
+ {
+ path: '/daoAnOffice',
+ name: 'daoAnOffice',
+ component: () => import('@/views/daoAnOffice/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(),
+]
+const router = createRouter({
+ history: createWebHashHistory(import.meta.env.BASE_URL),
routes,
-});
-index.beforeEach(() => {
- if (!NProgress.isStarted())
- NProgress.start();
-});
+})
-index.afterEach(() => {
- NProgress.done();
-});
+router.beforeEach((to, from, next) => {
+ next();
+})
-export default index;
+export default router
--
Gitblit v1.8.0