-
Notifications
You must be signed in to change notification settings - Fork 38
/
vue2-loading-bar.min.js
executable file
·8 lines (8 loc) · 1.86 KB
/
vue2-loading-bar.min.js
1
2
3
4
5
6
7
8
!function(t,i){"object"==typeof exports&&"object"==typeof module?module.exports=i():"function"==typeof define&&define.amd?define([],i):"object"==typeof exports?exports.LoadingBar=i():t.LoadingBar=i()}(this,function(){return function(t){function i(o){if(r[o])return r[o].exports;var n=r[o]={exports:{},id:o,loaded:!1};return t[o].call(n.exports,n,n.exports,i),n.loaded=!0,n.exports}var r={};return i.m=t,i.c=r,i.p="./build/",i(0)}([function(t,i){"use strict";/*! Copyright (c) 2016 Naufal Rabbani (http://github.com/BosNaufal)
* Licensed Under MIT (http://opensource.org/licenses/MIT)
*
* Vue 2 Loading Bar - Version 0.0.1
*
*/
t.exports={name:"LoadingBar",props:{id:String,customClass:String,progress:{type:Number,"default":0},direction:{type:String,"default":"right"},error:Boolean,onErrorDone:{type:Function,required:!0},onProgressDone:{type:Function,required:!0}},data:function(){return{show:!0,full:"",width:0,wait:!1,myError:!1}},render:function(t){var i=this.direction,r=this.customClass,o=this.id,n=(this.width,this.show),e=this.full,s=this.myError,u=this.styling;return t("div",null,[n?t("div",{attrs:{id:o?o:null},"class":"LoadingBar LoadingBar--to_"+i+" "+(r?r:"")+(s?"LoadingBar--error":"")+(e?"LoadingBar--full":""),style:u()},[t("div",{"class":"LoadingBar-glow"},[])]):null])},watch:{progress:function(t,i){var r=this;i!==t&&(this.width=t,setTimeout(function(){r.isFull()}))},error:function(t,i){var r=this;i!==t&&t&&(this.width=100,this.myError=!0,setTimeout(function(){r.isFull()}))}},methods:{isFull:function r(){var t=this,r=100===this.width;r&&(this.wait=!0,setTimeout(function(){t.full=!0,t.myError=!1,t.onErrorDone(),setTimeout(function(){t.show=!1,t.width=0,t.wait=!1,setTimeout(function(){t.full="",t.show=!0,t.onProgressDone()})},250)},700))},styling:function(){return this.wait?{width:"100%"}:{width:this.width+"%"}}}}}])});
//# sourceMappingURL=vue2-loading-bar.min.js.map