fix(projects): 修复页面滚动行为

This commit is contained in:
Soybean
2021-09-14 19:10:10 +08:00
parent ab77d58e46
commit 57e00e6417
12 changed files with 189 additions and 113 deletions

View File

@ -11,8 +11,7 @@ const isVercel = import.meta.env.VITE_HTTP_ENV === 'VERCEL';
const router = createRouter({
history: isVercel ? createWebHashHistory() : createWebHistory(),
routes,
scrollBehavior: () => ({ left: 0, top: 0 })
routes
});
export async function setupRouter(app: App) {

5
src/router/menus.ts Normal file
View File

@ -0,0 +1,5 @@
import { CustomRoute } from '@/interface';
export function transformRouteToMenu(routes: CustomRoute[]) {
return routes;
}

View File

@ -1,7 +1,7 @@
import type { RouteRecordRaw } from 'vue-router';
import { BasicLayout, BlankLayout } from '@/layouts';
import { EnumRoutePath, EnumRouteTitle } from '@/enum';
import type { RoutePathKey, LoginModuleType } from '@/interface';
import type { CustomRoute, RoutePathKey, LoginModuleType } from '@/interface';
import { getLoginModuleRegExp } from '@/utils';
/** 路由名称 */
@ -83,7 +83,7 @@ export const constantRoutes: RouteRecordRaw[] = [
/**
* 自定义路由
*/
export const customRoutes: Array<RouteRecordRaw> = [
export const customRoutes: CustomRoute[] = [
{
name: RouteNameMap.get('root'),
path: EnumRoutePath.root,