|
@@ -3,12 +3,12 @@
|
|
|
<div v-swiper:mySwiper="swiperOption">
|
|
<div v-swiper:mySwiper="swiperOption">
|
|
|
<div class="swiper-wrapper">
|
|
<div class="swiper-wrapper">
|
|
|
<div class="swiper-slide" v-for="banner in sliceBanners">
|
|
<div class="swiper-slide" v-for="banner in sliceBanners">
|
|
|
- <a :href="banner.hrefUrl" target="_blank" v-if="banner.hrefUrl">
|
|
|
|
|
|
|
+ <a :href="banner.detailsLink" target="_blank" v-if="banner.detailsLink">
|
|
|
<img :src="banner.pictureLink"/>
|
|
<img :src="banner.pictureLink"/>
|
|
|
</a>
|
|
</a>
|
|
|
- <span v-if="!banner.hrefUrl">
|
|
|
|
|
- <img :src="banner.pictureLink"/>
|
|
|
|
|
- </span>
|
|
|
|
|
|
|
+ <span v-else>
|
|
|
|
|
+ <img :src="banner.pictureLink"/>
|
|
|
|
|
+ </span>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="swiper-button-prev"><i class="iconfont icon-swiper-left"></i></div>
|
|
<div class="swiper-button-prev"><i class="iconfont icon-swiper-left"></i></div>
|
|
|
<div class="swiper-button-next"><i class="iconfont icon-swiper-right"></i></div>
|
|
<div class="swiper-button-next"><i class="iconfont icon-swiper-right"></i></div>
|
|
@@ -32,29 +32,12 @@
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
<script>
|
|
<script>
|
|
|
|
|
+ import { carousel } from '~utils/mixin'
|
|
|
export default {
|
|
export default {
|
|
|
|
|
+ mixins: [carousel],
|
|
|
data () {
|
|
data () {
|
|
|
return {
|
|
return {
|
|
|
- activeSlide: 0,
|
|
|
|
|
- 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
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ activeSlide: 0
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
filters: {
|
|
filters: {
|
|
@@ -97,6 +80,19 @@
|
|
|
},
|
|
},
|
|
|
sliceBanners () {
|
|
sliceBanners () {
|
|
|
return this.banners.data && this.banners.data.length ? this.banners.data.slice(0, 3) : []
|
|
return this.banners.data && this.banners.data.length ? this.banners.data.slice(0, 3) : []
|
|
|
|
|
+ },
|
|
|
|
|
+ swiperOption () {
|
|
|
|
|
+ return {
|
|
|
|
|
+ autoplay: 6000,
|
|
|
|
|
+ pagination: '.swiper-pagination',
|
|
|
|
|
+ paginationClickable: true,
|
|
|
|
|
+ mousewheelControl: false,
|
|
|
|
|
+ effect: this.effect,
|
|
|
|
|
+ lazyLoading: true,
|
|
|
|
|
+ loop: true,
|
|
|
|
|
+ prevButton: '.swiper-button-prev',
|
|
|
|
|
+ nextButton: '.swiper-button-next'
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|