|
@@ -1,10 +1,51 @@
|
|
|
<template>
|
|
|
- <div class="banner"></div>
|
|
|
+ <div class="banner">
|
|
|
+ <div v-swiper:mySwiper="swiperOption" class="swiper-container">
|
|
|
+ <div class="swiper-wrapper">
|
|
|
+ <div class="swiper-slide" v-for="banner in banners">
|
|
|
+ <a>
|
|
|
+ <img :src="banner.pictureLink"/>
|
|
|
+ </a>
|
|
|
+ </div>
|
|
|
+ <div v-if="banners.length === 0" class="swiper-button-prev"><i class="iconfont icon-swiper-left"></i></div>
|
|
|
+ <div v-if="banners.length === 0"class="swiper-button-next"><i class="iconfont icon-swiper-right"></i></div>
|
|
|
+ </div>
|
|
|
+ <div v-if="banners.length === 0" class="swiper-pagination swiper-pagination-bullets"></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
export default {
|
|
|
- name: 'BannerView'
|
|
|
+ name: 'BannerView',
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ swiperOption: {
|
|
|
+ autoplay: 6000,
|
|
|
+ pagination: '.swiper-pagination',
|
|
|
+ paginationClickable: true,
|
|
|
+ mousewheelControl: false,
|
|
|
+ effect: 'fade',
|
|
|
+ lazyLoading: true,
|
|
|
+ loop: true,
|
|
|
+ prevButton: '.swiper-button-prev',
|
|
|
+ nextButton: '.swiper-button-next',
|
|
|
+ onTransitionStart: (swiper) => {
|
|
|
+ if (this.banners.data && this.banners.data.length && (swiper.activeIndex > this.banners.data.length)) {
|
|
|
+ swiper.activeIndex = 1
|
|
|
+ }
|
|
|
+ if (this.banners.data && this.banners.data.length && swiper.activeIndex <= 0) {
|
|
|
+ swiper.activeIndex = this.banners.data.length
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ banners () {
|
|
|
+ return this.$store.state.supplier.detail.banner.data.data
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
|