2 lines
1.3 KiB
JavaScript
2 lines
1.3 KiB
JavaScript
"use strict";const e=require("../../../common/vendor.js"),t={name:"fui-progress",emits:["activeend"],props:{percent:{type:[Number,String],default:0},height:{type:[Number,String],default:8},radius:{type:[Number,String],default:8},showInfo:{type:Boolean,default:!1},size:{type:[Number,String],default:28},color:{type:String,default:"#333"},percentWidth:{type:[Number,String],default:96},background:{type:String,default:"#CCCCCC"},activeColor:{type:String,default:""},duration:{type:[Number,String],default:15}},watch:{percent(e){this.darwProgress()}},mounted(){this.$nextTick((()=>{this.darwProgress()}))},computed:{getActiveColor(){return this.activeColor}},data:()=>({percentage:0,translateX:"-100%",time:0}),methods:{darwProgress(){let e=Number(this.percent);e=e>100?100:e,this.time=Number(this.duration)*Math.abs(e-this.percentage)/1e3,e<this.percentage&&this.percentage-e>30&&(this.time=this.time/2),this.percentage=e,this.translateX=100-e+"%",setTimeout((()=>{this.$emit("activeend",{})}),this.time)}}};const r=e._export_sfc(t,[["render",function(t,r,i,a,n,s){return e.e({a:i.activeColor?"":1,b:s.getActiveColor,c:`translate3d(-${n.translateX},0,0)`,d:`${n.time}s`,e:i.height+"rpx",f:i.radius+"rpx",g:i.background,h:i.showInfo},i.showInfo?{i:e.t(n.percentage),j:i.percentWidth+"rpx",k:i.size+"rpx",l:i.color}:{})}],["__scopeId","data-v-6f0bbc93"]]);wx.createComponent(r);
|