
css样式
/* base-ui/ms-progress-bar/index.wxss */ @other-font: 28rpx; @ms-primary:#169BD5; @ms-success:#29AA4F; .progress-bar-area{ height: 36rpx; position: relative; } .progress-bar{ height: inherit; transition: width 0.2s linear; position: absolute; z-index: 1; } .bar-text{ font-size: @other-font;
position: absolute; left: 50%; z-index: 2; }
js样式
Component({
properties: {
percentage:{
type:Number,
value:0
},
barColor:{
type:String,
value:"rgb(0, 204, 0)"
},
textColor:{
type:String,
value:"#fff"
},
trackColor:{
type:String,
value:"#e5e5e5"
}
},
data: {
},
methods: {
}
})
html样式
<view class="progress-bar-area" style="background-color: {{trackColor}};">
<view class="progress-bar" style="background-color: {{barColor}};width: {{(percentage>100?100:percentage)+'%'}}"></view>
<view class="bar-text" style="color: {{textColor}};">{{percentage}}%</view>
</view>
|