ProgressBar_wev8.js
1.16 KB
define("ProgressBar_html",function(){return'<div id="NMEC_${id}" class="wev-comp-${compType}"> <div class="wev-progress-bar" style="height: ${lineHeight}; background-color: ${bgcolor};"> \t<div style="color: ${fontColor}; line-height: ${lineHeight}; font-size: ${fontSize}; background-color: ${areaColor};width:${percentageWidth}%;">${percentageFace}</div> </div></div>'}),define(["mUtil","Component"],function(n,t){return t.init(function(e){t.super(this,e),this.type="ProgressBar",this.tpl=this.type+"_html";var i=this.viewModel={bgcolor:"#DDD",fontColor:"#FFF",lineHeight:"22px",fontSize:"12px",showValue:!0};this.beforeMount=function(){var e,t,r=Number(i.value),o=0;i.fontSize=(parseFloat(i.fontSize)||12)+"px",i.lineHeight=(parseFloat(i.lineHeight)||22)+"px",r<0||isNaN(r)?r=0:o=100<r?100:r,~i.value.toString().indexOf(".")&&(e=r,t=Number(2),isNaN(t)&&(t=2),r=(e=Math.round(e*Math.pow(10,t))/Math.pow(10,t)).toFixed(t)),i.percentageWidth=o,i.percentageFace=i.showValue?r+"%":"",i.value=r,n.isArray(i.areaColor)&&i.areaColor.every(function(e){var t=Number(e.startPercent),o=Number(e.endPercent);return!(t<=r&&r<=o&&(i.areaColor=e.areaColor,1))})},this.mounted=function(){}})});