This commit is contained in:
2026-01-23 02:35:52 +08:00
parent 9849f93b1e
commit 2db3868fcf
39 changed files with 3381 additions and 164 deletions

View File

@@ -1,8 +1,8 @@
const isDev = process.env.NODE_ENV === "development";
const BASE_NAME = isDev ? '' : '/root/perler-beads';
export const isDev = process.env.NODE_ENV === "development";
const BASE_NAME = isDev ? '' : '/root/center';
export const basename = BASE_NAME;
export const wrapBasename = (path: string) => {
const hasEnd = path.endsWith('/')
let _basename = basename;
@@ -14,5 +14,13 @@ export const wrapBasename = (path: string) => {
if (isDev) {
return _basename
}
return _basename + '.html';
return !hasEnd ? _basename + '/' : _basename;
}
export const openLink = (path: string, target: string = '_self') => {
if (path.startsWith('http://') || path.startsWith('https://')) {
window.open(path, target);
return;
}
const url = wrapBasename(path);
window.open(url, target);
}