import './scss/loading.scss'; /** * 页面全局 Loading 刷新页面或者登陆的loading * @method start 创建 loading * @method done 移除 loading */ export const NextLoading = { laoding: false, start: () => { if (NextLoading.laoding) return NextLoading.laoding = true const bodys: Element = document.body; const div = document.createElement('div'); div.setAttribute('class', 'loading-next'); const htmls = `
`; div.innerHTML = htmls; bodys.insertBefore(div, bodys.childNodes[0]); }, done: () => { setTimeout(() => { NextLoading.laoding = false const el = document.querySelector('.loading-next'); el && el.parentNode?.removeChild(el); }, 1000); }, };