fix:修VITE_API_BASE_URL

This commit is contained in:
fangyunong 2025-08-13 15:05:47 +08:00
parent a64ddd6afe
commit 019e1dd933
3 changed files with 8 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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
})