PublishApply.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <div class="publish-apply">
  3. <div v-swiper:mySwiper="swiperOption" class="swiper-container">
  4. <div class="swiper-wrapper">
  5. <div class="swiper-slide" v-for="banner in banners">
  6. <a>
  7. <img :src="banner.pictureLink"/>
  8. </a>
  9. </div>
  10. <div v-if="banners.length === 0" class="swiper-button-prev"><i class="iconfont icon-swiper-left"></i></div>
  11. <div v-if="banners.length === 0"class="swiper-button-next"><i class="iconfont icon-swiper-right"></i></div>
  12. </div>
  13. <div v-if="banners.length === 0" class="swiper-pagination swiper-pagination-bullets"></div>
  14. </div>
  15. </div>
  16. </template>
  17. <script>
  18. export default {
  19. data () {
  20. return {
  21. swiperOption: {
  22. autoplay: 6000,
  23. pagination: '.swiper-pagination',
  24. paginationClickable: true,
  25. mousewheelControl: false,
  26. effect: 'fade',
  27. lazyLoading: true,
  28. loop: true,
  29. prevButton: '.swiper-button-prev',
  30. nextButton: '.swiper-button-next',
  31. onTransitionStart: (swiper) => {
  32. if (this.banners.data && this.banners.data.length && (swiper.activeIndex > this.banners.data.length)) {
  33. swiper.activeIndex = 1
  34. }
  35. if (this.banners.data && this.banners.data.length && swiper.activeIndex <= 0) {
  36. swiper.activeIndex = this.banners.data.length
  37. }
  38. }
  39. }
  40. }
  41. },
  42. computed: {
  43. banners () {
  44. return this.$store.state.applyPurchase.purchaseBannerList.bannerList.data.data
  45. }
  46. }
  47. }
  48. </script>
  49. <style lang="scss">
  50. .publish-apply {
  51. border-radius: 5px;
  52. height: 400px;
  53. margin-bottom: 20px;
  54. .swiper-container {
  55. z-index: 2;
  56. width: 955px;
  57. height: 400px;
  58. .swiper-wrapper {
  59. width: 955px;
  60. height: 400px;
  61. margin: 0 auto;
  62. .swiper-slide {
  63. height: 400px;
  64. margin: 0 auto;
  65. display: flex;
  66. img {
  67. width: 955px;
  68. height: 400px;
  69. border-radius: 5px;
  70. }
  71. }
  72. .swiper-button-prev i, .swiper-button-next i {
  73. font-size: 26px;
  74. }
  75. }
  76. .swiper-pagination-bullets {
  77. .swiper-pagination-bullet {
  78. width: 10px!important;
  79. height: 10px!important;
  80. }
  81. }
  82. }
  83. }
  84. </style>