x-steps.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <view class="step_box">
  3. <view class="same_row_in item_step" v-for="(item,index) in list" :key="index">
  4. <view class="same_row_in" style="padding-right: 10rpx;">
  5. <view class="step_box_num center_in" :class="current >= item.id ? 'activeColor' : 'inactiveColor'">
  6. {{item.id}}
  7. </view>
  8. <view class="box_title_step" :class="current >= item.id ? 'activeFontColor' : 'inactiveFontColor'">
  9. {{item.title}}
  10. </view>
  11. </view>
  12. <u-icon name="arrow-right" color="#dddddd" size="10" style="margin-left: 4rpx;"
  13. v-if="index < (list.length - 1)"></u-icon>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. name: 'x-steps',
  20. props: {
  21. current: {
  22. type: Number,
  23. default () {
  24. return 1
  25. }
  26. },
  27. list: {
  28. type: Array,
  29. default () {
  30. return [{
  31. id: 1,
  32. title: '选择药品',
  33. }, {
  34. id: 2,
  35. title: '确定清单',
  36. }, {
  37. id: 3,
  38. title: '医生开方',
  39. }, {
  40. id: 4,
  41. title: '下单购买',
  42. }]
  43. }
  44. },
  45. },
  46. data() {
  47. return {
  48. // list: [{
  49. // id: 1,
  50. // title: '选择药品',
  51. // }, {
  52. // id: 2,
  53. // title: '确定清单',
  54. // }, {
  55. // id: 3,
  56. // title: '医生开方',
  57. // }, {
  58. // id: 4,
  59. // title: '下单购买',
  60. // }]
  61. }
  62. }
  63. }
  64. </script>
  65. <style lang="scss">
  66. .step_box {
  67. display: flex;
  68. align-items: center;
  69. justify-content: space-around;
  70. background-color: #fff;
  71. // margin: 20rpx;
  72. padding: 20rpx;
  73. border-radius: 10rpx;
  74. }
  75. .item_step {
  76. flex: 1;
  77. justify-content: space-around;
  78. }
  79. .step_box_num {
  80. width: 32rpx;
  81. height: 32rpx;
  82. border-radius: 50%;
  83. color: #fff;
  84. font-size: 20rpx;
  85. margin-right: 5rpx;
  86. }
  87. .box_title_step {
  88. font-size: 24rpx;
  89. }
  90. .activeColor {
  91. background-color: $x-color;
  92. }
  93. .inactiveColor {
  94. background-color: #dddddd;
  95. }
  96. .activeFontColor {
  97. font-weight: 600;
  98. }
  99. .inactiveFontColor {
  100. color: $u-info;
  101. }
  102. </style>