fix:修VITE_API_BASE_URL
This commit is contained in:
parent
a64ddd6afe
commit
019e1dd933
@ -1,2 +1,2 @@
|
||||
VITE_API_BASE_URL=http://zeronode.cn
|
||||
VITE_API_BASE_URL=https://api.zeronode.cn
|
||||
VITE_FRONTEND_CALLBACK_URL=http://localhost:5173/callback
|
@ -1,3 +1,3 @@
|
||||
# .env.production (生产环境)
|
||||
VITE_API_BASE_URL=http://zeronode.cn
|
||||
VITE_API_BASE_URL=https://api.zeronode.cn
|
||||
VITE_FRONTEND_CALLBACK_URL=http://zeronode.cn/callback # 或者你的生产环境前端URL
|
@ -15,20 +15,21 @@ interface MenuItem {
|
||||
children?: MenuItem[];
|
||||
}
|
||||
function getComponent(componentPath: string) {
|
||||
// 处理view-router特殊路由
|
||||
if (componentPath === 'view-router') {
|
||||
// 如果没有组件路径,返回 RouterView
|
||||
if (!componentPath) {
|
||||
return RouterView
|
||||
}
|
||||
|
||||
// 动态导入组件,添加错误处理
|
||||
return () => {
|
||||
try {
|
||||
// 尝试动态导入组件
|
||||
const componentPromise = import(`../views/${componentPath}`)
|
||||
// 确保路径包含 .vue 扩展名
|
||||
const fullPath = componentPath.endsWith('.vue') ? componentPath : `${componentPath}.vue`
|
||||
const componentPromise = import(`../views/${fullPath}`)
|
||||
|
||||
// 成功加载则返回组件
|
||||
return componentPromise.catch(() => {
|
||||
console.error(`组件加载失败: @/views/${componentPath}, 回退到404页面`)
|
||||
console.error(`组件加载失败: @/views/${fullPath}, 回退到404页面`)
|
||||
return NotFound
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user