element-gui
Version:
A Component Library for Vue.js.
1 lines • 4.26 kB
JavaScript
module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/dist/",r(r.s=88)}({0:function(t,e,r){"use strict";function n(t,e,r,n,o,s,i,u){var a,c="function"==typeof t?t.options:t;if(e&&(c.render=e,c.staticRenderFns=r,c._compiled=!0),n&&(c.functional=!0),s&&(c._scopeId="data-v-"+s),i?(a=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(i)},c._ssrRegister=a):o&&(a=u?function(){o.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:o),a)if(c.functional){c._injectStyles=a;var l=c.render;c.render=function(t,e){return a.call(e),l(t,e)}}else{var d=c.beforeCreate;c.beforeCreate=d?[].concat(d,a):[a]}return{exports:t,options:c}}r.d(e,"a",(function(){return n}))},8:function(t,e){t.exports=require("vue")},88:function(t,e,r){"use strict";r.r(e);var n=function(){var t=this.$createElement,e=this._self._c||t;return e("transition",{attrs:{name:"fade"}},[e("div",{directives:[{name:"show",rawName:"v-show",value:this.show,expression:"show"}],class:this.classes,style:this.outerStyles},[e("div",{class:this.innerClasses,style:this.styles})])])};n._withStripped=!0;var o={name:"LoadingBar",props:{color:{type:String,default:"primary"},failedColor:{type:String,default:"error"},height:{type:Number,default:2}},data:function(){return{percent:0,status:"success",show:!1}},computed:{classes:function(){return"el-loading-bar"},innerClasses:function(){var t;return["el-loading-bar__inner",(t={},t["is-primary"]="primary"===this.color&&"success"===this.status,t["is-error"]="error"===this.failedColor&&"error"===this.status,t)]},outerStyles:function(){return{height:this.height+"px"}},styles:function(){var t={width:this.percent+"%",height:this.height+"px"};return"primary"!==this.color&&"success"===this.status&&(t.backgroundColor=this.color),"error"!==this.failedColor&&"error"===this.status&&(t.backgroundColor=this.failedColor),t}}},s=r(0),i=Object(s.a)(o,n,[],!1,null,null,null).exports,u=r(8),a=r.n(u);i.newInstance=function(t){var e=t||{},r=new a.a({data:e,render:function(t){return t(i,{props:e})}}),n=r.$mount();document.body.appendChild(n.$el);var o=r.$children[0];return{update:function(t){"percent"in t&&(o.percent=t.percent),t.status&&(o.status=t.status),"show"in t&&(o.show=t.show)},component:o,destroy:function(){document.body.removeChild(document.getElementsByClassName("el-loading-bar")[0])}}};var c=i,l=void 0,d="primary",f=800,h="error",p=2,v=void 0;function y(){return l=l||c.newInstance({color:d,failedColor:h,height:p})}function m(t){y().update(t)}function _(){setTimeout((function(){m({show:!1}),setTimeout((function(){m({percent:0})}),200)}),f)}function g(){v&&(clearInterval(v),v=null)}e.default={start:function(){if(!v){var t=0;m({percent:t,status:"success",show:!0}),v=setInterval((function(){(t+=Math.floor(3*Math.random()+1))>95&&g(),m({percent:t,status:"success",show:!0})}),200)}},update:function(t){g(),m({percent:t,status:"success",show:!0})},finish:function(){g(),m({percent:100,status:"success",show:!0}),_()},error:function(){g(),m({percent:100,status:"error",show:!0}),_()},config:function(t){t.color&&(d=t.color),t.duration&&(f=t.duration),t.failedColor&&(h=t.failedColor),t.height&&(p=t.height)},destroy:function(){g();var t=y();l=null,t.destroy()}}}});