Files
aiclientpureui/src/utils/publicAsset.js
949036910@qq.com e827e9425e 11
2026-06-01 00:03:56 +08:00

12 lines
442 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 解析 public/ 目录下的静态资源 URL。
* 开发环境 base 为 `/`,发行部署 base 为 `/images/newyaoyan/`(见 vite.config.js
*
* @param {string} path - 相对 public 的路径,如 subtitle-templates/system-templates.json
*/
export function publicAssetUrl(path) {
const base = import.meta.env.BASE_URL || "/";
const normalized = String(path || "").replace(/^\/+/, "");
return `${base}${normalized}`;
}