fix: 移除所有硬编码的localhost:8080,使用相对路径
- 创建utils/config.ts集中管理API_BASE和文件URL - 删除.env文件(VITE_SERVER_API_URL=http://localhost:8080) - env.ts默认API前缀改为/api/v1匹配后端路由 - 替换16处硬编码的localhost:8080引用
This commit is contained in:
@@ -7,6 +7,7 @@ import LanguageChange from '@/components/language-change.vue'
|
||||
import ThemePopover from '@/components/custom-theme/theme-popover.vue'
|
||||
import ToggleTheme from '@/components/toggle-theme.vue'
|
||||
import api from '@/services/api'
|
||||
import { getFileUrl } from '@/utils/config'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
@@ -72,11 +73,7 @@ const breadcrumbs = computed(() => {
|
||||
})
|
||||
|
||||
function getAssetUrl(path: string) {
|
||||
if (!path)
|
||||
return ''
|
||||
if (path.startsWith('http'))
|
||||
return path
|
||||
return `${import.meta.env.VITE_API_BASE || 'http://localhost:8080'}${path}`
|
||||
return getFileUrl(path)
|
||||
}
|
||||
|
||||
function updateFavicon(favicon: string) {
|
||||
|
||||
Reference in New Issue
Block a user