index.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <div class="simple-step">
  3. <div
  4. class="simple-step__item"
  5. v-for="(item, index) in list"
  6. :key="index"
  7. :class="{ active: item.id === active }"
  8. >
  9. <span v-text="item[label]"></span>
  10. <span class="simple-step__line"></span>
  11. </div>
  12. </div>
  13. </template>
  14. <script>
  15. export default {
  16. name: 'simple-step',
  17. props: {
  18. list: {
  19. type: Array,
  20. default: [],
  21. },
  22. label: {
  23. type: String,
  24. default: 'label',
  25. },
  26. active: {
  27. type: Number,
  28. default: 0,
  29. },
  30. },
  31. }
  32. </script>
  33. <style lang="scss" scoped>
  34. // pc端
  35. @media screen and (min-width: 768px) {
  36. .simple-step {
  37. display: flex;
  38. justify-content: space-evenly;
  39. align-items: center;
  40. padding: 24px 0;
  41. .simple-step__item {
  42. font-size: 24px;
  43. color: #282828;
  44. position: relative;
  45. padding-bottom: 4px;
  46. &.active {
  47. .simple-step__line {
  48. position: absolute;
  49. bottom: 0;
  50. left: 0;
  51. width: 100%;
  52. height: 3px;
  53. @include themify($themes) {
  54. background-color: themed('color');
  55. }
  56. }
  57. }
  58. }
  59. }
  60. }
  61. // 移动端
  62. @media screen and (max-width: 768px) {
  63. .simple-step {
  64. display: flex;
  65. justify-content: space-evenly;
  66. align-items: center;
  67. padding: 8vw 0 6vw;
  68. .simple-step__item {
  69. font-size: 4.2vw;
  70. color: #999;
  71. position: relative;
  72. padding-bottom: 1.2vw;
  73. &.active {
  74. color: #282828;
  75. .simple-step__line {
  76. position: absolute;
  77. bottom: 0;
  78. left: 0;
  79. width: 100%;
  80. height: 0.5vw;
  81. @include themify($themes) {
  82. background-color: themed('color');
  83. }
  84. }
  85. }
  86. }
  87. }
  88. }
  89. </style>