yuyang
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
4 additions and
1 deletions
-
globals.d.ts
-
src/router/index.js
|
|
@ -3,7 +3,7 @@ declare type ClassName = { [className: string]: any } | ClassName[] | string; |
|
|
|
|
|
|
|
declare interface ImportMeta { |
|
|
|
env: { |
|
|
|
MODE: 'mock' | 'development' | 'test' | 'release'; |
|
|
|
MODE: 'mock' | 'development' | 'test' | 'release' | 'site'; |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -4,6 +4,8 @@ import baseRouters from './modules/base'; |
|
|
|
import componentsRouters from './modules/components'; |
|
|
|
import othersRouters from './modules/others'; |
|
|
|
|
|
|
|
const env = import.meta.env.MODE || 'development'; |
|
|
|
|
|
|
|
// 存放动态路由
|
|
|
|
export const asyncRouterList = [...baseRouters, ...componentsRouters, ...othersRouters]; |
|
|
|
|
|
|
@ -24,6 +26,7 @@ const defaultRouterList = [ |
|
|
|
const createRouter = () => |
|
|
|
new VueRouter({ |
|
|
|
mode: 'history', |
|
|
|
base: env === 'site' ? '/starter/vue/' : null, |
|
|
|
routes: defaultRouterList, |
|
|
|
scrollBehavior() { |
|
|
|
return { x: 0, y: 0 }; |
|
|
|