UNPKG

@tarojs/components

Version:
38 lines (34 loc) 1.66 kB
import { r as registerInstance, h, H as Host } from './index-ab3c86da.js'; const indexCss = ".weui-progress{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex}.weui-progress__bar{background-color:#ebebeb;-ms-flex:1;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) { 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, "%"))))); } }; Progress.style = indexCss; export { Progress as taro_progress_core };