整体优化

This commit is contained in:
2026-08-04 17:33:45 +08:00
parent cadc8885f3
commit 2c69b3f1c3
32 changed files with 2212 additions and 643 deletions

View File

@ -1,7 +1,10 @@
export function useConfig() {
const files = import.meta.glob("./*.ts", { eager: true }) as Record<string, any>;
Object.keys(files).forEach(key => {
const name = key.replace(/(\.\/|\.ts)/g, "");
(window as Record<string, any>)["$" + name] = files[key].default as any;
});
Object.keys(files)
// 排除自身 index.ts避免挂载出无意义的 $index
.filter(key => !key.endsWith("/index.ts"))
.forEach(key => {
const name = key.replace(/(\.\/|\.ts)/g, "");
(window as Record<string, any>)["$" + name] = files[key].default as any;
});
}