import { nextTick } from "vue"; import "@/styles/loading.scss"; export const loading = { show: (value?: string) => { const bodys: Element = document.body; const div = document.createElement("div"); div.className = "block-loading"; div.innerHTML = `
${value ? `
${value}
` : ""}
`; bodys.insertBefore(div, bodys.childNodes[0]); }, hide: () => { nextTick(() => { setTimeout(() => { const el = document.querySelector(".block-loading"); el && el.parentNode?.removeChild(el); }, 1000); }); } };