feat: 添加 PWA 插件支持,更新环境变量处理,优化可见性选项

This commit is contained in:
xiongxiao
2026-03-18 17:00:49 +08:00
committed by cnb
parent 0b08b82356
commit bc9ce9e5df
6 changed files with 31 additions and 15 deletions

View File

@@ -19,4 +19,14 @@ export const getDynamicBasename = (): string => {
}
// 默认使用构建时的 basename
return basename
}
export const openLink = (path: string, target: string = '_self') => {
if (path.startsWith('http://') || path.startsWith('https://')) {
window.open(path, target);
return;
}
const url = new URL(path, window.location.origin);
url.pathname = wrapBasename(url.pathname);
window.open(url.toString(), target);
}