index.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <view class="content">
  3. <swiper class="swiper-box" :current="current" autoplay circular>
  4. <swiper-item v-for="(item, index) in info" :key="index">
  5. <view :class="item.colorClass" class="swiper-item">
  6. <image class="image" :src="item.url" mode="aspectFill" :draggable="false" @click="onBanner(index)" />
  7. </view>
  8. </swiper-item>
  9. </swiper>
  10. <view class="">
  11. <component is="xueche" class="animation-fade"></component>
  12. </view>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. import xueche from '@/components/home/index'
  18. export default {
  19. components: {
  20. xueche
  21. },
  22. data() {
  23. return {
  24. active: 0,
  25. info: [{
  26. colorClass: 'uni-bg-red',
  27. url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/094a9dc0-50c0-11eb-b680-7980c8a877b8.jpg',
  28. content: '内容 A'
  29. },
  30. {
  31. colorClass: 'uni-bg-green',
  32. url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/094a9dc0-50c0-11eb-b680-7980c8a877b8.jpg',
  33. content: '内容 B'
  34. },
  35. {
  36. colorClass: 'uni-bg-blue',
  37. url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/094a9dc0-50c0-11eb-b680-7980c8a877b8.jpg',
  38. content: '内容 C'
  39. }
  40. ],
  41. current: 0,
  42. mode: 'round',
  43. }
  44. }
  45. }
  46. </script>
  47. <style lang="scss">
  48. .content {
  49. background-color: #F1F1F1;
  50. }
  51. .swiper-box {
  52. width: 100vw;
  53. height: 56.25vw;
  54. .image {
  55. width: 100%;
  56. }
  57. }
  58. .sticky-top {
  59. position: sticky;
  60. top: 0px;
  61. left: 0;
  62. background-color: #4fc08d;
  63. z-index: 10;
  64. display: flex;
  65. justify-content: center;
  66. align-items: center;
  67. // border-top-left-radius: 14px;
  68. // border-top-right-radius: 14px;
  69. padding-right: 3%;
  70. .top-search {
  71. flex: 1;
  72. }
  73. }
  74. .sticky-bottom {
  75. position: sticky;
  76. bottom: 0;
  77. left: 0;
  78. background-color: #fff;
  79. z-index: 10;
  80. }
  81. .fadeIn {
  82. animation: fadeIn 5s linear 2s infinite alternate;
  83. }
  84. @keyframes fadeIn {
  85. from {
  86. opacity: 0;
  87. }
  88. to {
  89. opacity: 1;
  90. }
  91. }
  92. </style>