index.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <!--
  2. * @Description:
  3. * @Author: vivi
  4. * @Date: 2023-05-06 14:58:54
  5. * @LastEditTime: 2023-05-19 11:52:27
  6. -->
  7. <template>
  8. <view class="step-status">
  9. <view class="step-status-item" v-for="(li, index) in list" :key="index">
  10. <view
  11. class="step-status-item-lable"
  12. :style="{
  13. color: step >= index + 1 ? activeColor : '',
  14. }"
  15. @click="handleItem(li)"
  16. >
  17. {{ li }}
  18. </view>
  19. <uni-icons
  20. type="forward"
  21. class="step-status-item-icons"
  22. size="15"
  23. :style="{
  24. color: step > index + 1 ? activeColor : '',
  25. left: `calc((100% / ${list.length}) * ${index + 1})`,
  26. }"
  27. v-if="index != list.length - 1"
  28. ></uni-icons>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. export default {
  34. name: "Step-status",
  35. props: {
  36. list: {
  37. type: Object,
  38. default: [],
  39. },
  40. step: {
  41. type: Number,
  42. default: 1,
  43. },
  44. activeColor: {
  45. type: String,
  46. default: "#409EFF",
  47. },
  48. },
  49. data() {
  50. // 这里存放数据
  51. return {};
  52. },
  53. // 生命周期 - 创建完成(可以访问当前this实例)
  54. created() {},
  55. // 生命周期 - 挂载完成(可以访问DOM元素)
  56. mounted() {},
  57. methods: {
  58. handleItem(event) {
  59. this.$emit("stepsClick", event);
  60. },
  61. },
  62. };
  63. </script>
  64. <style scoped lang="scss">
  65. .step-status {
  66. position: relative;
  67. width: 100%;
  68. height: 40px;
  69. opacity: 1;
  70. background: #ffffff;
  71. border-radius: 10px;
  72. box-shadow: 0px 4px 16px 0px rgba(0, 0, 0, 0.06);
  73. display: flex;
  74. align-items: center;
  75. justify-content: space-around;
  76. padding: 0 10upx;
  77. &-item {
  78. display: flex;
  79. // width: 100%;
  80. &-lable {
  81. }
  82. &-icons {
  83. position: absolute;
  84. top: 13px;
  85. }
  86. }
  87. }
  88. </style>