Browse Source

Signed-off-by: caner <5658514@qq.com>

caner 3 years ago
parent
commit
98406cd0c1
2 changed files with 5 additions and 4 deletions
  1. 0 3
      README.md
  2. 5 1
      src/pages/index/main.ts

+ 0 - 3
README.md

@@ -1,7 +1,4 @@
 # vue3+TS+Eslint 多入口模板
-```
-框架默认采用vite+vue3+TS+Eslint
-```
 
 ## 注意
 ```

+ 5 - 1
src/pages/index/main.ts

@@ -6,6 +6,7 @@ import { createRouter, createWebHashHistory } from 'vue-router'
 import '@/utils/rem'
 // 动态路由
 const routes = Object.values(import.meta.glob('./views/*/route.ts', { eager: true })).map((m) => (m as any).default || m)
+routes.push({ path: '/:path(.*)', redirect: '/' })
 const store = createPinia()
 const app = createApp(App)
 const router = createRouter({
@@ -13,7 +14,10 @@ const router = createRouter({
   routes
 })
 // 路由守卫
-
+router.beforeEach((to, from, next) => {
+  // do something
+  next()
+})
 app.use(store)
   .use(naive)
   .use(router)