From 8bb882287f78bc0dbf832d0e2c229676fc608c41 Mon Sep 17 00:00:00 2001 From: midfar Date: Thu, 9 Mar 2023 10:44:33 +0800 Subject: [PATCH] update config --- src/router/index.js | 2 ++ vite.config.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/router/index.js b/src/router/index.js index 518ffc2..8432c9b 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -389,6 +389,8 @@ export const asyncRoutes = [ const createTheRouter = () => createRouter({ // history: createWebHashHistory(import.meta.env.BASE_URL), + // 注意,如果要配置 HTML5 模式,则需要修改nginx配置,参考资料: + // https://router.vuejs.org/zh/guide/essentials/history-mode.html history: createWebHistory(import.meta.env.BASE_URL), scrollBehavior: () => ({ top: 0 }), routes: constantRoutes diff --git a/vite.config.js b/vite.config.js index 2ff0dca..82bdda9 100644 --- a/vite.config.js +++ b/vite.config.js @@ -20,7 +20,7 @@ export default defineConfig(({ command, mode }) => { const prodMock = true; return { - base: '/', // hash模式配置"./",url模式配置"/" + base: './', // 注意,必须以"/"结尾 define: { 'process.env': env },