feat: 图标支持根据语言上传对应图标
This commit is contained in:
21
src/plugins/file-static-url.ts
Normal file
21
src/plugins/file-static-url.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { sessionGet } from '@/utils/cache-session-utils';
|
||||
import { validHttp } from '@/utils/regular-utils';
|
||||
|
||||
/**
|
||||
* 解析资源文件绝对路径 http
|
||||
* @param path 服务端资源文件
|
||||
* @returns
|
||||
*/
|
||||
export function parseUrlPath(path: string) {
|
||||
if (!path || path === '#') {
|
||||
return '#';
|
||||
}
|
||||
if (validHttp(path)) {
|
||||
return path;
|
||||
}
|
||||
// 兼容旧前端可改配置文件
|
||||
const baseUrl = import.meta.env.PROD
|
||||
? sessionGet('baseUrl') || import.meta.env.VITE_API_BASE_URL
|
||||
: import.meta.env.VITE_API_BASE_URL;
|
||||
return `${baseUrl}${path}`;
|
||||
}
|
||||
Reference in New Issue
Block a user