refactor(router): 将 HOME_PAGE 常量移至 utils 模块并改进实现
将 HOME_PAGE 常量从 router/config.ts 移动到 utils/index.ts 模块 实现根据 page.json 动态获取首页路径,默认使用第一个页面 更新 router/interceptor.ts 中的导入路径
This commit is contained in:
@@ -181,3 +181,9 @@ export function getEnvBaseUploadUrl() {
|
||||
* 是否是双token模式
|
||||
*/
|
||||
export const isDoubleTokenMode = import.meta.env.VITE_AUTH_MODE === 'double'
|
||||
|
||||
/**
|
||||
* 首页路径,通过 page.json 里面的 type 为 home 的页面获取,如果没有,则默认是第一个页面
|
||||
* 通常为 /pages/index/index
|
||||
*/
|
||||
export const HOME_PAGE = `/${pages.find(page => page.type === 'home')?.path || pages[0].path}`
|
||||
|
||||
Reference in New Issue
Block a user