2 lines
1.8 KiB
JavaScript
2 lines
1.8 KiB
JavaScript
var e,t;import{Y as s,Z as r,o as i,j as n,w as a,h as o,y as l,a0 as u,I as h,l as g,z as d,B as c,A as p}from"./index-d4baa715.js";import{_ as v}from"./_plugin-vue_export-helper.1b428a4d.js";const _=v({name:"uv-line-progress",mixins:[s,r,{props:{activeColor:{type:String,default:"#19be6b"},inactiveColor:{type:String,default:"#ececec"},percentage:{type:[String,Number],default:0},showText:{type:Boolean,default:!0},height:{type:[String,Number],default:12},...null==(t=null==(e=uni.$uv)?void 0:e.props)?void 0:t.lineProgress}}],data:()=>({lineWidth:0}),watch:{percentage(e){this.resizeProgressWidth()}},computed:{progressStyle(){let e={};return e.width=this.lineWidth,e.backgroundColor=this.activeColor,e.height=this.$uv.addUnit(this.$uv.getPx(this.height)),e},innserPercentage(){return this.$uv.range(0,100,this.percentage)}},mounted(){this.init()},methods:{init(){this.$uv.sleep(20).then((()=>{this.resizeProgressWidth()}))},getProgressWidth(){return this.$uvGetRect(".uv-line-progress__background")},resizeProgressWidth(){this.getProgressWidth().then((e=>{const{width:t}=e;this.lineWidth=t*this.innserPercentage/100+"px"}))}}},[["render",function(e,t,s,r,v,_){const y=c,f=p;return i(),n(y,{class:"uv-line-progress",style:l([e.$uv.addStyle(e.customStyle)])},{default:a((()=>[o(y,{class:"uv-line-progress__background",ref:"uv-line-progress__background",style:l([{backgroundColor:e.inactiveColor,height:e.$uv.addUnit(e.$uv.getPx(e.height))}])},null,8,["style"]),o(y,{class:"uv-line-progress__line",style:l([_.progressStyle])},{default:a((()=>[u(e.$slots,"default",{},(()=>[e.showText&&e.percentage>=10?(i(),n(f,{key:0,class:"uv-line-progress__text"},{default:a((()=>[h(g(_.innserPercentage+"%"),1)])),_:1})):d("",!0)]),!0)])),_:3},8,["style"])])),_:3},8,["style"])}],["__scopeId","data-v-24f05804"]]);export{_};
|