step.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <view class="step-box">
  3. <!-- :iconBorderRadius="" -->
  4. <cu-progress ref="cuProgressRef" :value="percent" width="100%" @dragging="dragging" strokeWidth="4rpx" handleSize="18rpx" handleColor="#fff"
  5. activeColor="#05C175" noActiveColor="#e6e6e6" progressMainH='22rpx'></cu-progress>
  6. <view class="step-node-nums">
  7. <view class="num-ratio">0%</view>
  8. <view class="num-ratio"><text class="t">25%</text></view>
  9. <view class="num-ratio"><text class="t">50%</text></view>
  10. <view class="num-ratio"><text class="t">75%</text></view>
  11. <view class="num-ratio"><text>100%</text></view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. props: {
  18. width: {
  19. type: Number,
  20. default: 0
  21. },
  22. percent: {
  23. type: Number,
  24. default: 0
  25. }
  26. },
  27. data() {
  28. return {
  29. };
  30. },
  31. watch:{
  32. // percent:{
  33. // handler(newNum , oldNum){
  34. // if(newNum === 0 && newNum !== oldNum){
  35. // this.$nextTick(() => {
  36. // this.$refs.cuProgressRef.initialNum()
  37. // })
  38. // }
  39. // },
  40. // immediate:true,
  41. // }
  42. },
  43. methods: {
  44. // 百分比滑动条
  45. dragging(e) {
  46. // const num = `${e.value}%`
  47. this.$emit('update:percent', e.value)
  48. },
  49. }
  50. }
  51. </script>
  52. <style lang="scss" scoped>
  53. .step-box {
  54. width: 100%;
  55. height: 50rpx;
  56. border-radius: 2rpx;
  57. display: flex;
  58. flex-direction: column;
  59. justify-content: space-between;
  60. ::v-deep .cu-handle {
  61. border: 6rpx solid #05C175;
  62. background-color: #fff;
  63. }
  64. .step-node-nums {
  65. width: 100%;
  66. display: flex;
  67. justify-content: space-between;
  68. .num-ratio {
  69. width: 1rpx;
  70. font-size: 20rpx;
  71. font-family: PingFang SC, PingFang SC-Regular;
  72. font-weight: 400;
  73. text-align: center;
  74. color: #808080;
  75. line-height: 28rpx;
  76. position: relative;
  77. .t {
  78. position: absolute;
  79. left: 50%;
  80. transform: translateX(-50%);
  81. }
  82. // &:first-child {
  83. // text-align: left;
  84. // }
  85. &:last-child {
  86. text {
  87. position: absolute;
  88. right: 0;
  89. }
  90. }
  91. }
  92. }
  93. }
  94. </style>