scrollWeek.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <view :style="`${show ? 'overflow-x: auto;' :'overflow: hidden;'}`" class="scroll">
  3. <view @click="cutItem(item,index)" class="scroll-item" v-for="(item,index) in list" :key="index">
  4. <view class="">
  5. {{item}}
  6. </view>
  7. <!-- <view class="">
  8. {{item.semester}}
  9. </view> -->
  10. <view v-if="index == active" class="scroll-item-color">
  11. </view>
  12. </view>
  13. <view v-if="!show" class="scroll-text">
  14. <view class="scroll-text-left">
  15. </view>
  16. <view class="scroll-text-right">
  17. 成为VIP查看历史成绩
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. name: "scrollWeel\k",
  25. props: {
  26. list: {
  27. type: Array,
  28. default: () => []
  29. },
  30. show: {
  31. type: Boolean,
  32. default: () => true
  33. }
  34. },
  35. data() {
  36. return {
  37. active: 0
  38. };
  39. },
  40. methods: {
  41. cutItem(item, index) {
  42. this.active = index
  43. }
  44. }
  45. }
  46. </script>
  47. <style lang="scss" scoped>
  48. ::-webkit-scrollbar {
  49. width: 0 !important;
  50. height: 0 !important;
  51. display: none;
  52. }
  53. .scroll {
  54. width: 100%;
  55. height: 100rpx;
  56. background-color: #fff;
  57. display: flex;
  58. overflow-x: auto;
  59. position: relative;
  60. .scroll-text {
  61. position: absolute;
  62. left: 0;
  63. height: 100%;
  64. display: flex;
  65. width: 100%;
  66. color: #fff;
  67. .scroll-text-left {
  68. width: 222rpx;
  69. }
  70. .scroll-text-right {
  71. flex: 1;
  72. background-color: rgba(183, 183, 183, 0.92);
  73. display: flex;
  74. flex-direction: column;
  75. align-items: center;
  76. justify-content: center;
  77. }
  78. }
  79. .scroll-item {
  80. display: flex;
  81. flex-direction: column;
  82. flex-shrink: 0;
  83. width: 140rpx;
  84. display: flex;
  85. flex-direction: column;
  86. align-items: center;
  87. justify-content: center;
  88. position: relative;
  89. .scroll-item-color {
  90. position: absolute;
  91. bottom: 14rpx;
  92. left: 50%;
  93. transform: translate(-50%, 0);
  94. width: 100rpx;
  95. height: 6rpx;
  96. background-color: rgba(5, 204, 161, 1);
  97. }
  98. }
  99. }
  100. </style>