2022-05-11 16:36:52 +08:00

22 lines
420 B
TypeScript

export function revisePath(path: string) {
if (!path) {
return "";
}
return path[0] == "/" ? path : `/${path}`;
}
export function createLink(url: string, id?: string) {
const link = document.createElement("link");
link.href = url;
link.type = "text/css";
link.rel = "stylesheet";
if (id) {
link.id = id;
}
setTimeout(() => {
document.getElementsByTagName("head").item(0)?.appendChild(link);
}, 0);
}