123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- <template>
- <view class="step-box" @touchstart="touchStart" @touchmove='move'>
- <view class="step-link">
- <view class="step-bg" :style="{'width': `${stepRatio}%`}"></view>
- <view class="step-node">
- <view :class="['node-item' , stepRatio >= 0 ? 'active-node-item' : '' , stepRatio == 0 ? 'now-node-item' : '' ]"></view>
- <view :class="['node-item' , stepRatio >= 25 ? 'active-node-item' : '' , stepRatio == 25 ? 'now-node-item' : '' ]"></view>
- <view :class="['node-item' , stepRatio >= 50 ? 'active-node-item' : '' , stepRatio == 50 ? 'now-node-item' : '' ]"></view>
- <view :class="['node-item' , stepRatio >= 75 ? 'active-node-item' : '' , stepRatio == 75 ? 'now-node-item' : '' ]"></view>
- <view :class="['node-item' , stepRatio >= 100 ? 'active-node-item' : '' , stepRatio == 100 ? 'now-node-item' : '' ]"></view>
- </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 {
- data() {
- return {
- stepRatio: 0,
-
- movePlace:null,
- };
- },
- methods:{
- touchStart(e){
- this.movePlace = e.changedTouches[0].clientX
-
- },
- touchEnd(e){
-
- // console.log('touchEnd = ' , e.changedTouches[0])
-
-
- },
- move(e){
- const PlaceX = e.changedTouches[0].clientX
- console.log('move = ' , PlaceX , this.movePlace )
- if(PlaceX < this.movePlace ){
- if(this.stepRatio > 0){
- this.stepRatio -= 1;
- }
- }else{
- if(this.stepRatio < 100){
- this.stepRatio += 1;
- }
- }
-
-
-
- this.movePlace = e.changedTouches[0].clientX;
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .step-box {
- width: 100%;
- height: 54rpx;
- border-radius: 2rpx;
- .step-link {
- height: 6rpx;
- background: #e6e6e6;
- border-radius: 3rpx;
- position: relative;
- .step-bg {
- position: absolute;
- z-index: 1;
- left: 0;
- top: 0;
- background-color: #05C175;
- border-radius: 3rpx;
-
- height: 100%;
- }
- .step-node {
- position: absolute;
- z-index: 1;
- width: 100%;
- height: 100%;
- display: flex;
- justify-content: space-between;
- align-items: center;
- .node-item{
- width: 16rpx;
- height: 16rpx;
- background: #ffffff;
- border: 4rpx solid #e6e6e6;
- border-radius: 50%;
- }
- .active-node-item{
- border-color: #05c175;
- }
- .now-node-item{
- width: 22rpx;
- height: 22rpx;
- border: 6rpx solid #05c175;
- }
- }
- }
- // <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>
- .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>
|