@tarojs/components
Version:
35 lines (32 loc) • 1.31 kB
JavaScript
import { r as registerInstance, h, H as Host } from './index-980f930f.js';
const Progress = class {
constructor(hostRef) {
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 (h(Host, { class: 'weui-progress' }, h("div", { class: 'weui-progress__bar', style: pgHeight }, h("div", { class: 'weui-progress__inner-bar', style: pgWidth })), showInfo && (h("div", { class: 'weui-progress__opr', style: { 'font-size': `${fontSize}px` } }, h("span", null, pgPercent, "%")))));
}
};
export { Progress as taro_progress_core };