优化一下产品库加载
This commit is contained in:
		| @@ -58,22 +58,42 @@ const $decimalCalc = (...arr) => { | ||||
|   //返回计算值 | ||||
|   return intArr.reduce((t, a) => t + a) / precision | ||||
| } | ||||
| /** | ||||
|  * @param { function } func | ||||
|  | ||||
|  * @param { number } wait 延迟执行毫秒数 | ||||
|  | ||||
|  * @param { boolean } immediate  true 表立即执行,false 表非立即执行 | ||||
|  */ | ||||
|  | ||||
|  | ||||
| export const waiting = { | ||||
|   init(ops, count) { | ||||
|     if (document.body) { | ||||
|       let div = document.createElement('div') | ||||
|       div.id = "ai-waiting" | ||||
|       div.className = "el-loading-mask is-fullscreen" | ||||
|       div.style.zIndex = '202204271710' | ||||
|       div.style.textAlign = 'center' | ||||
|       div.style.lineHeight = '100vh' | ||||
|       div.style.color = '#26f' | ||||
|       div.style.background = 'rgba(0,0,0,.8)' | ||||
|       document.body.appendChild(div) | ||||
|     } else if (count < 10) { | ||||
|       setTimeout(() => this.init(ops, ++count), 500) | ||||
|     } | ||||
|   }, | ||||
|   getDom() { | ||||
|     return document.querySelector('#ai-waiting') | ||||
|   }, | ||||
|   setContent(html) { | ||||
|     let div = this.getDom() | ||||
|     div.innerHTML = html | ||||
|   }, | ||||
|   close() { | ||||
|     let div = this.getDom() | ||||
|     div.parentElement.removeChild(div) | ||||
|   } | ||||
| } | ||||
|  | ||||
| export default { | ||||
|   ...tools, | ||||
|   addChildParty, | ||||
|   $confirm, | ||||
|   $permissions, | ||||
|   $decimalCalc | ||||
|   $decimalCalc, | ||||
|   $waiting: waiting | ||||
| } | ||||
|  | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user