mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-07 08:57:19 +08:00
fix: 修复getHistoryMode
函数中环境变量未初始化带来的页面热更新报错
This commit is contained in:
parent
49d88b367d
commit
8fc9a4eca6
@ -61,7 +61,7 @@ export const remainingPaths = Object.keys(remainingRouter).map(v => {
|
|||||||
|
|
||||||
/** 创建路由实例 */
|
/** 创建路由实例 */
|
||||||
export const router: Router = createRouter({
|
export const router: Router = createRouter({
|
||||||
history: getHistoryMode(),
|
history: getHistoryMode(import.meta.env.VITE_ROUTER_HISTORY),
|
||||||
routes: constantRoutes.concat(...(remainingRouter as any)),
|
routes: constantRoutes.concat(...(remainingRouter as any)),
|
||||||
strict: true,
|
strict: true,
|
||||||
scrollBehavior(to, from, savedPosition) {
|
scrollBehavior(to, from, savedPosition) {
|
||||||
|
@ -322,8 +322,7 @@ function addAsyncRoutes(arrRoutes: Array<RouteRecordRaw>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 获取路由历史模式 https://next.router.vuejs.org/zh/guide/essentials/history-mode.html */
|
/** 获取路由历史模式 https://next.router.vuejs.org/zh/guide/essentials/history-mode.html */
|
||||||
function getHistoryMode(): RouterHistory {
|
function getHistoryMode(routerHistory): RouterHistory {
|
||||||
const routerHistory = import.meta.env.VITE_ROUTER_HISTORY;
|
|
||||||
// len为1 代表只有历史模式 为2 代表历史模式中存在base参数 https://next.router.vuejs.org/zh/api/#%E5%8F%82%E6%95%B0-1
|
// len为1 代表只有历史模式 为2 代表历史模式中存在base参数 https://next.router.vuejs.org/zh/api/#%E5%8F%82%E6%95%B0-1
|
||||||
const historyMode = routerHistory.split(",");
|
const historyMode = routerHistory.split(",");
|
||||||
const leftMode = historyMode[0];
|
const leftMode = historyMode[0];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user