Skip to content

Commit

Permalink
feat: 增加多个预览服务站点
Browse files Browse the repository at this point in the history
  • Loading branch information
oljc committed Feb 24, 2025
1 parent 22a632d commit a6c381a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
4 changes: 4 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
12 changes: 8 additions & 4 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import NProgress from 'nprogress';
import 'nprogress/nprogress.css';

import { appRoutes } from './routes';
import { REDIRECT_MAIN, NOT_FOUND_ROUTE } from './routes/base';
import { REDIRECT_MAIN } from './routes/base';
import { DEFAULT_ROUTE_NAME, LOGIN_ROUTE_NAME } from './constants';
import createRouteGuard from './guard';

NProgress.configure({ showSpinner: false });

const router = createRouter({
history: createWebHistory(),
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/',
Expand All @@ -24,9 +24,13 @@ const router = createRouter({
requiresAuth: false
}
},
{
path: '/:pathMatch(.*)*',
name: 'notFound',
component: () => import('@/views/not-found/index.vue')
},
...appRoutes,
REDIRECT_MAIN,
NOT_FOUND_ROUTE
REDIRECT_MAIN
],
scrollBehavior() {
return { top: 0 };
Expand Down
6 changes: 0 additions & 6 deletions src/router/routes/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,3 @@ export const REDIRECT_MAIN: RouteRecordRaw = {
}
]
};

export const NOT_FOUND_ROUTE: RouteRecordRaw = {
path: '/:pathMatch(.*)*',
name: 'notFound',
component: () => import('@/views/not-found/index.vue')
};
3 changes: 3 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"rewrites": [{ "source": "/:path*", "destination": "/index.html" }]
}

0 comments on commit a6c381a

Please sign in to comment.