123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- <template>
- <view class="step-box">
- <view class="slider-item-box">
- <u-slider class="step-slider" v-model="stepRatio" activeColor="#05C175" min="0" max="100"
- inactiveColor="#e6e6e6">
- </u-slider>
- <view class="slider-item">
- <text
- :class="['item' , stepRatio >= 0 ? 'active-item' : '' , stepRatio == 0 ? 'now-item' : '' ]"></text>
- <text
- :class="['item' , stepRatio >= 25 ? 'active-item' : '' , stepRatio == 25 ? 'now-item' : '' ]"></text>
- <text
- :class="['item' , stepRatio >= 50 ? 'active-item' : '' , stepRatio == 50 ? 'now-item' : '' ]"></text>
- <text
- :class="['item' , stepRatio >= 75 ? 'active-item' : '' , stepRatio == 75 ? 'now-item' : '' ]"></text>
- <text
- :class="['item' , stepRatio >= 100 ? 'active-item' : '' , stepRatio == 100 ? 'now-item' : '' ]"></text>
- </view>
- </view>
- <view class="step-node-nums">
- <view class="num-ratio">0%</view>
- <view class="num-ratio">25%</view>
- <view class="num-ratio">50%</view>
- <view class="num-ratio">75%</view>
- <view class="num-ratio">100%</view>
- </view>
- </view>
- </template>
- <script>
- export default {
- props: {
- width: {
- type: Number,
- default: 0
- },
- percent: {
- type: Number,
- default: 0
- }
- },
- data() {
- return {
- stepRatio: 0,
- };
- },
- watch: {
- percent: {
- handler(newPercent , old) {
- if(newPercent !== old){
- this.stepRatio = newPercent || 0
- }
-
- },
- immediate: true
- },
- stepRatio: {
- handler(stepRatio , old) {
- if(stepRatio !== old){
- this.$emit("update:percent", stepRatio)
- }
-
- },
- immediate: true
- }
- },
- methods: {
- }
- }
- </script>
- <style lang="scss" scoped>
- .step-box {
- width: 100%;
- height: 54rpx;
- border-radius: 2rpx;
- .slider-item-box {
- width: 100%;
- height: 22rpx;
- display: flex;
- align-items: center;
- position: relative;
- .slider-item {
- position: absolute;
- left: 0;
- top: 0;
- width: 100%;
- height: 100%;
- display: flex;
- justify-content: space-between;
- align-items: center;
- .item {
- width: 16rpx;
- height: 16rpx;
- background: #ffffff;
- border: 4rpx solid #e6e6e6;
- border-radius: 50%;
- }
- .active-item {
- border-color: #05c175;
- }
- .now-item {}
- }
- }
- .step-slider {
- width: 100%;
- position: relative;
- .slider-item {
- position: absolute;
- width: 10px;
- height: 10px;
- background-color: red;
- }
- ::v-deep uni-slider {
- margin: 0;
- .uni-slider-handle-wrapper {
- height: 6rpx;
- }
- .uni-slider-thumb {
- margin-top: -11rpx !important;
- width: 22rpx !important;
- height: 22rpx !important;
- border: 6rpx solid #05c175;
- }
- }
- }
- .step-node-nums {
- width: 100%;
- display: flex;
- justify-content: space-between;
- padding-top: 10rpx;
- .num-ratio {
- flex: 1;
- font-size: 20rpx;
- font-family: PingFang SC, PingFang SC-Regular;
- font-weight: 400;
- text-align: center;
- color: #808080;
- line-height: 28rpx;
- &:first-child {
- text-align: left;
- }
- &:last-child {
- text-align: right;
- }
- }
- }
- }
- </style>
|