@tarojs/components
Version:
42 lines (36 loc) • 1.69 kB
JavaScript
Object.defineProperty(exports, '__esModule', { value: true });
const index = require('./index-a7069008.js');
const indexCss = ".weui-progress{align-items:center;display:flex}.weui-progress__bar{background-color:#ebebeb;flex:1;height:3px}.weui-progress__inner-bar{background-color:#09bb07;width:0;height:100%}.weui-progress__opr{margin-left:15px;font-size:0;display:block}";
const Progress = class {
constructor(hostRef) {
index.registerInstance(this, hostRef);
this.percent = 0;
this.showInfo = false;
this.borderRadius = 0;
this.fontSize = 16;
this.strokeWidth = 6;
this.activeColor = '#09BB07';
this.backgroundColor = '#EBEBEB';
this.active = false;
}
render() {
const { percent, showInfo, borderRadius, fontSize, strokeWidth, activeColor, backgroundColor, active } = this;
const pgPercent = percent > 100 ? 100 : percent < 0 ? 0 : percent;
const pgHeight = {
height: strokeWidth + 'px',
backgroundColor
};
const transition = active ? 'width 1s ease-in-out' : 'none';
const pgWidth = {
width: `${pgPercent}%`,
transition,
WebkitTransition: transition,
backgroundColor: activeColor,
borderRadius: borderRadius ? `${borderRadius}px` : '0px'
};
return (index.h(index.Host, { class: 'weui-progress' }, index.h("div", { class: 'weui-progress__bar', style: pgHeight }, index.h("div", { class: 'weui-progress__inner-bar', style: pgWidth })), showInfo && (index.h("div", { class: 'weui-progress__opr', style: { 'font-size': `${fontSize}px` } }, index.h("span", null, pgPercent, "%")))));
}
};
Progress.style = indexCss;
exports.taro_progress_core = Progress;
;