diff --git a/.env.development b/.env.development index d0ccee5..7f414c5 100644 --- a/.env.development +++ b/.env.development @@ -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 \ No newline at end of file diff --git a/.env.production b/.env.production index 1b7268b..0713992 100644 --- a/.env.production +++ b/.env.production @@ -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 \ No newline at end of file diff --git a/src/utils/permission.ts b/src/utils/permission.ts index aca4453..dce46b9 100644 --- a/src/utils/permission.ts +++ b/src/utils/permission.ts @@ -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 })