前端初始化

This commit is contained in:
“hsc”
2026-08-21 15:36:24 +08:00
commit e4d8ecde13
14411 changed files with 2275932 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
import { isClient } from "../browser.mjs";
//#region ../../packages/utils/vue/global-node.ts
const globalNodes = [];
let target = !isClient ? void 0 : document.body;
function createGlobalNode(id) {
const el = document.createElement("div");
if (id !== void 0) el.setAttribute("id", id);
if (target) {
target.appendChild(el);
globalNodes.push(el);
}
return el;
}
function removeGlobalNode(el) {
globalNodes.splice(globalNodes.indexOf(el), 1);
el.remove();
}
function changeGlobalNodesTarget(el) {
if (el === target) return;
target = el;
globalNodes.forEach((el) => {
if (target && !el.contains(target)) target.appendChild(el);
});
}
//#endregion
export { changeGlobalNodesTarget, createGlobalNode, removeGlobalNode };
//# sourceMappingURL=global-node.mjs.map