refactor(router): 使用环境变量配置路由基础路径
为了支持不同环境下的路由基础路径配置,将 `createWebHistory` 的参数从硬编码改为使用 `import.meta.env.VITE_BASE` 环境变量。这样可以更灵活地适配不同部署环境的需求。
Showing
1 changed file
with
1 additions
and
1 deletions
| ... | @@ -125,7 +125,7 @@ const routes = [ | ... | @@ -125,7 +125,7 @@ const routes = [ |
| 125 | ] | 125 | ] |
| 126 | 126 | ||
| 127 | const router = createRouter({ | 127 | const router = createRouter({ |
| 128 | - history: createWebHistory(), | 128 | + history: createWebHistory(import.meta.env.VITE_BASE), |
| 129 | routes, | 129 | routes, |
| 130 | scrollBehavior(to, from, savedPosition) { | 130 | scrollBehavior(to, from, savedPosition) { |
| 131 | // 每次路由切换后,页面滚动到顶部 | 131 | // 每次路由切换后,页面滚动到顶部 | ... | ... |
-
Please register or login to post a comment