|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<div class="lunbo" ref="bgsw" v-swiper:mySwiper="swiperOptions">
|
|
|
- <ul class="swiper-wrapper">
|
|
|
+ <ul class="swiper-wrapper" :class="{touming: isloaing}">
|
|
|
<li
|
|
|
class="swiper-slide"
|
|
|
@click.stop="handleItem(item)"
|
|
@@ -53,11 +53,24 @@ import { directive } from "vue-awesome-swiper";
|
|
|
// import style (<= Swiper 5.x)
|
|
|
import "swiper/css/swiper.css";
|
|
|
|
|
|
+
|
|
|
+let SIZE = 6
|
|
|
+
|
|
|
export default {
|
|
|
props: ["list"],
|
|
|
data() {
|
|
|
+
|
|
|
+ let pagesPrev = this.list.slice(0,Math.round(this.list.length/2))
|
|
|
+ let pagesNext = this.list.slice(Math.round(this.list.length/2) - SIZE ,this.list.length)
|
|
|
+
|
|
|
+
|
|
|
+ let isshortData = this.list.length < 100
|
|
|
+ if (isshortData) {
|
|
|
+ pagesPrev = this.list
|
|
|
+ }
|
|
|
+
|
|
|
return {
|
|
|
- piclist: [...this.list],
|
|
|
+ piclist: [...pagesPrev],
|
|
|
active: "",
|
|
|
showBofang: "",
|
|
|
hadvideo: false,
|
|
@@ -66,6 +79,11 @@ export default {
|
|
|
noImg: false,
|
|
|
TO: null,
|
|
|
TT: null,
|
|
|
+ pagesNext:[...pagesNext],
|
|
|
+ pagesPrev:[...pagesPrev],
|
|
|
+ isshortData,
|
|
|
+ currrnt:'prev',
|
|
|
+ isloaing:false
|
|
|
};
|
|
|
},
|
|
|
directives: {
|
|
@@ -134,7 +152,56 @@ export default {
|
|
|
return {
|
|
|
slidesPerView: "auto",
|
|
|
observer:true,
|
|
|
- freeMode: true
|
|
|
+ observeParents: true,
|
|
|
+ freeMode: true,
|
|
|
+ on:{
|
|
|
+ reachEnd: ()=>{
|
|
|
+ if (this.isshortData) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.currrnt == 'prev') {
|
|
|
+ this.$showLoading();
|
|
|
+ this.isloaing = true
|
|
|
+ setTimeout(() => {
|
|
|
+ this.piclist = this.pagesNext
|
|
|
+ this.currrnt = 'next'
|
|
|
+ this.$refs.bgsw.swiper.slideTo(2, 0, false);
|
|
|
+ }, 500);
|
|
|
+
|
|
|
+ setTimeout(() => {
|
|
|
+
|
|
|
+ // this.$refs.bgsw.swiper.updateProgress()
|
|
|
+ // mySwiper.updateSlides();
|
|
|
+ this.$hideLoading();
|
|
|
+ this.isloaing = false
|
|
|
+ }, 2000);
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ reachBeginning: ()=>{
|
|
|
+ if (this.isshortData) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.currrnt == 'next') {
|
|
|
+ this.$showLoading();
|
|
|
+ this.isloaing = true
|
|
|
+ this.currrnt = 'prev'
|
|
|
+
|
|
|
+ setTimeout(() => {
|
|
|
+ this.piclist = this.pagesPrev
|
|
|
+ this.$refs.bgsw.swiper.slideTo(this.pagesPrev.length - SIZE, 0, false);
|
|
|
+ }, 500);
|
|
|
+
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$hideLoading();
|
|
|
+ this.isloaing = false
|
|
|
+
|
|
|
+ }, 2000);
|
|
|
+
|
|
|
+ // this.$refs.bgsw.swiper.slideTo(0,1000,false)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
};
|
|
|
},
|
|
|
},
|
|
@@ -363,6 +430,10 @@ export default {
|
|
|
transform: translateY(-55px);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ .touming{
|
|
|
+ // opacity: 0;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|
|
|
|