修正打包部署配置

This commit is contained in:
微微一笑
2025-07-10 09:14:44 +08:00
parent fa6af8602e
commit 9002ce6bc3
5 changed files with 61 additions and 7 deletions

View File

@ -30,14 +30,14 @@ const processResponse = async (res: any) => {
}
ElMessage.success(res.msg);
setTimeout(() => {
location.href = import.meta.env.VITE_APP_CONTEXT_PATH + 'index';
location.href = (import.meta.env.VITE_APP_CONTEXT_PATH || '/') + 'index';
}, 2000);
};
const handleError = (error: any) => {
ElMessage.error(error.message);
setTimeout(() => {
location.href = import.meta.env.VITE_APP_CONTEXT_PATH + 'index';
location.href = (import.meta.env.VITE_APP_CONTEXT_PATH || '/') + 'index';
}, 2000);
};

View File

@ -100,7 +100,7 @@ export const dynamicRoutes: RouteRecordRaw[] = [
* 创建路由
*/
const router = createRouter({
history: createWebHistory(import.meta.env.VITE_APP_CONTEXT_PATH),
history: createWebHistory(import.meta.env.VITE_APP_CONTEXT_PATH || '/'),
routes: constantRoutes,
// 刷新时,滚动条位置还原
scrollBehavior(to, from, savedPosition) {