This commit is contained in:
2026-02-24 20:13:27 +08:00
parent 689460193b
commit a281a0e6e2
135 changed files with 442 additions and 18762 deletions

22
src/modules/basename.ts Normal file
View File

@@ -0,0 +1,22 @@
// @ts-ignore
export const basename = BASE_NAME;
export const wrapBasename = (path: string) => {
const hasEnd = path.endsWith('/')
if (basename) {
return `${basename}${path}` + (hasEnd ? '' : '/');
} else {
return path;
}
}
// 动态计算 basename根据当前 URL 路径
export const getDynamicBasename = (): string => {
const path = window.location.pathname
const [user, key, id] = path.split('/').filter(Boolean)
if (key === 'v1' && id) {
return `/${user}/v1/${id}`
}
// 默认使用构建时的 basename
return basename
}