step.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <view class="step-box">
  3. <view class="slider-item-box">
  4. <u-slider class="step-slider" v-model="stepRatio" activeColor="#05C175" min="1" max="100" inactiveColor="#e6e6e6">
  5. </u-slider>
  6. <view class="slider-item">
  7. <text :class="['item' , stepRatio >= 0 ? 'active-item' : '' , stepRatio == 0 ? 'now-item' : '' ]"></text>
  8. <text :class="['item' , stepRatio >= 25 ? 'active-item' : '' , stepRatio == 25 ? 'now-item' : '' ]"></text>
  9. <text :class="['item' , stepRatio >= 50 ? 'active-item' : '' , stepRatio == 50 ? 'now-item' : '' ]"></text>
  10. <text :class="['item' , stepRatio >= 75 ? 'active-item' : '' , stepRatio == 75 ? 'now-item' : '' ]"></text>
  11. <text :class="['item' , stepRatio >= 100 ? 'active-item' : '' , stepRatio == 100 ? 'now-item' : '' ]"></text>
  12. </view>
  13. </view>
  14. <view class="step-node-nums">
  15. <view class="num-ratio">0%</view>
  16. <view class="num-ratio">25%</view>
  17. <view class="num-ratio">50%</view>
  18. <view class="num-ratio">75%</view>
  19. <view class="num-ratio">100%</view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. props: {
  26. width: {
  27. type: Number,
  28. default: 0
  29. }
  30. },
  31. data() {
  32. return {
  33. stepRatio: 30,
  34. };
  35. },
  36. methods: {
  37. }
  38. }
  39. </script>
  40. <style lang="scss" scoped>
  41. .step-box {
  42. width: 100%;
  43. height: 54rpx;
  44. border-radius: 2rpx;
  45. .slider-item-box {
  46. width: 100%;
  47. height: 22rpx;
  48. display: flex;
  49. align-items: center;
  50. position: relative;
  51. .slider-item {
  52. position: absolute;
  53. left: 0;
  54. top: 0;
  55. width: 100%;
  56. height: 100%;
  57. display: flex;
  58. justify-content: space-between;
  59. align-items: center;
  60. .item {
  61. width: 16rpx;
  62. height: 16rpx;
  63. background: #ffffff;
  64. border: 4rpx solid #e6e6e6;
  65. border-radius: 50%;
  66. }
  67. .active-item{
  68. border-color: #05c175;
  69. }
  70. .now-item{
  71. }
  72. }
  73. }
  74. .step-slider {
  75. width: 100%;
  76. position: relative;
  77. .slider-item {
  78. position: absolute;
  79. width: 10px;
  80. height: 10px;
  81. background-color: red;
  82. }
  83. ::v-deep uni-slider {
  84. margin: 0;
  85. .uni-slider-handle-wrapper {
  86. height: 6rpx;
  87. }
  88. .uni-slider-thumb {
  89. margin-top: -11rpx !important;
  90. width: 22rpx !important;
  91. height: 22rpx !important;
  92. border: 6rpx solid #05c175;
  93. }
  94. }
  95. }
  96. .step-node-nums{
  97. width: 100%;
  98. display: flex;
  99. justify-content: space-between;
  100. padding-top: 10rpx;
  101. .num-ratio{
  102. flex: 1;
  103. font-size: 20rpx;
  104. font-family: PingFang SC, PingFang SC-Regular;
  105. font-weight: 400;
  106. text-align: center;
  107. color: #808080;
  108. line-height: 28rpx;
  109. &:first-child{
  110. text-align: left;
  111. }
  112. &:last-child{
  113. text-align: right;
  114. }
  115. }
  116. }
  117. }
  118. </style>