@moohng/dui
Version:
基于 Vue 3 的轻量级组件库
2 lines (1 loc) • 5.47 kB
JavaScript
!function(t,n){"use strict";const e=document.body,o=document.scrollingElement||document.documentElement;let r;const i={afterOpen(){r=o.scrollTop;const{style:t}=e;t.position="fixed",t.width="100%",t.top=-r+"px"},beforeClose(){const{style:t}=e;t.position="",t.width="",t.top="",o.scrollTop=r}};var c=n.defineComponent({name:"dui-loading",data:()=>({show:!1,loadingText:"数据加载中"}),methods:{open(t){this.loadingText=t||this.loadingText,this.show=!0,i.afterOpen()},close(){i.beforeClose(),this.show=!1,this.$emit("close")}}});const u=n.createVNode("div",{class:"mask transparent"},null,-1),l={class:"dui-loading__body pd"},a=n.createVNode("i",{class:"dui-icon__loading"},null,-1),f={class:"mt-sm"};c.render=function(t,e,o,r,i,c){return n.openBlock(),n.createBlock("div",{class:["dui-loading",{show:t.show}]},[u,n.createVNode("div",l,[a,n.createVNode("div",f,n.toDisplayString(t.loadingText),1)])],2)},c.__file="src/components/loading/loading.vue";var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},p=function(t){return t&&t.Math==Math&&t},d=p("object"==typeof globalThis&&globalThis)||p("object"==typeof window&&window)||p("object"==typeof self&&self)||p("object"==typeof s&&s)||function(){return this}()||Function("return this")(),y=function(t){try{return!!t()}catch(t){return!0}},g=!y((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),h={}.propertyIsEnumerable,m=Object.getOwnPropertyDescriptor,b={f:m&&!h.call({1:2},1)?function(t){var n=m(this,t);return!!n&&n.enumerable}:h},w=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}},v={}.toString,T="".split,j=y((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==function(t){return v.call(t).slice(8,-1)}(t)?T.call(t,""):Object(t)}:Object,O=function(t){return j(function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}(t))},E=function(t){return"object"==typeof t?null!==t:"function"==typeof t},P=function(t,n){if(!E(t))return t;var e,o;if(n&&"function"==typeof(e=t.toString)&&!E(o=e.call(t)))return o;if("function"==typeof(e=t.valueOf)&&!E(o=e.call(t)))return o;if(!n&&"function"==typeof(e=t.toString)&&!E(o=e.call(t)))return o;throw TypeError("Can't convert object to primitive value")},S={}.hasOwnProperty,C=function(t,n){return S.call(t,n)},_=d.document,I=E(_)&&E(_.createElement),x=!g&&!y((function(){return 7!=Object.defineProperty((t="div",I?_.createElement(t):{}),"a",{get:function(){return 7}}).a;var t})),D=Object.getOwnPropertyDescriptor,N={f:g?D:function(t,n){if(t=O(t),n=P(n,!0),x)try{return D(t,n)}catch(t){}if(C(t,n))return w(!b.f.call(t,n),t[n])}},V=/#|\.prototype\./,A=function(t,n){var e=L[F(t)];return e==k||e!=M&&("function"==typeof n?y(n):!!n)},F=A.normalize=function(t){return String(t).replace(V,".").toLowerCase()},L=A.data={},M=A.NATIVE="N",k=A.POLYFILL="P",$=A,z={},B=function(t,n,e){if(function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function")}(t),void 0===n)return t;switch(e){case 0:return function(){return t.call(n)};case 1:return function(e){return t.call(n,e)};case 2:return function(e,o){return t.call(n,e,o)};case 3:return function(e,o,r){return t.call(n,e,o,r)}}return function(){return t.apply(n,arguments)}},G=function(t){if(!E(t))throw TypeError(String(t)+" is not an object");return t},Y=Object.defineProperty,q={f:g?Y:function(t,n,e){if(G(t),n=P(n,!0),G(e),x)try{return Y(t,n,e)}catch(t){}if("get"in e||"set"in e)throw TypeError("Accessors not supported");return"value"in e&&(t[n]=e.value),t}},H=g?function(t,n,e){return q.f(t,n,w(1,e))}:function(t,n,e){return t[n]=e,t},J=N.f,K=function(t){var n=function(n,e,o){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(n);case 2:return new t(n,e)}return new t(n,e,o)}return t.apply(this,arguments)};return n.prototype=t.prototype,n},Q=function(t,n){var e,o,r,i,c,u,l,a,f=t.target,s=t.global,p=t.stat,y=t.proto,g=s?d:p?d[f]:(d[f]||{}).prototype,h=s?z:z[f]||(z[f]={}),m=h.prototype;for(r in n)e=!$(s?r:f+(p?".":"#")+r,t.forced)&&g&&C(g,r),c=h[r],e&&(u=t.noTargetGet?(a=J(g,r))&&a.value:g[r]),i=e&&u?u:n[r],e&&typeof c==typeof i||(l=t.bind&&e?B(i,d):t.wrap&&e?K(i):y&&"function"==typeof i?B(Function.call,i):i,(t.sham||i&&i.sham||c&&c.sham)&&H(l,"sham",!0),h[r]=l,y&&(C(z,o=f+"Prototype")||H(z,o,{}),z[o][r]=i,t.real&&m&&!m[r]&&H(m,r,i)))},R=function(t){return"function"==typeof t?t:void 0},U=function(t,n){return arguments.length<2?R(z[t])||R(d[t]):z[t]&&z[t][n]||d[t]&&d[t][n]}("navigator","userAgent")||"",W=[].slice,X=function(t){return function(n,e){var o=arguments.length>2,r=o?W.call(arguments,2):void 0;return t(o?function(){("function"==typeof n?n:Function(n)).apply(this,r)}:n,e)}};Q({global:!0,bind:!0,forced:/MSIE .\./.test(U)},{setTimeout:X(d.setTimeout),setInterval:X(d.setInterval)}),Q({target:"Date",stat:!0},{now:function(){return(new Date).getTime()}});z.Date.now;const Z={install:t=>{let e;t.config.globalProperties.$loading=o=>{if(!e){const{instance:t}=function(t){const e=document.createElement("div");document.body.appendChild(e);const o=n.createApp(t);return{instance:o.mount(e),unmount:()=>{o.unmount(e),document.body.removeChild(e)}}}(c);e=t}e.open(o),t.config.globalProperties.$loading.hide=e.close},t.component(c.name,c)}};t.default=Z,t.plugin=Z,Object.defineProperty(t,"__esModule",{value:!0})}(this.loading=this.loading||{},Vue);