support sub path

This commit is contained in:
MaysWind
2025-03-04 23:39:16 +08:00
parent e83b959930
commit 872639fefa
4 changed files with 24 additions and 11 deletions
+10
View File
@@ -0,0 +1,10 @@
export function getBasePath(): string {
const path = window.location.pathname;
const lastSlashIndex = path.lastIndexOf('/');
if (lastSlashIndex < 0) {
return path;
}
return path.substring(0, lastSlashIndex);
}