viewScroll.vue 1.6 KB

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