日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

swiper 在turn.js不能滚动

發布時間:2023/12/31 编程问答 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 swiper 在turn.js不能滚动 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

這個問題,使用turn.js的同學一定遇到過,那怎么解決呢?

答案: 翻到對應包含swiper 的那頁,重新初始化swiper

假設這個是第3頁

<div class="page-container flipbook" id="magazine"><divv-for="(n, index) in 9":key="`phone_${index}`":class="`page${index}`"class="page"><component :is="`Page${index}`" :current="currentPage"> </component></div></div>

我們綁定對應的currentPage,代表當前翻到第幾頁

$('#magazine').turn({width: 750,height: 961,elevation: 50,display: 'single',gradients: true,autoCenter: true,duration: 800,acceleration: true,// zoom: 0.1,page: self.page,when: {turned: function(e, page, view) {self.currentPage = page //獲取翻到當前第幾頁console.log(page, 'page')},},})

然后在第三頁里面監聽current的值

<div class="swiper-wrap"><div class="swiper-container"><div class="swiper-wrapper"><divclass="swiper-slide"v-for="(item, index) of swiperData":key="`three_${index}`"><a :href="item.url"><img :src="item.imgSrc" alt="" /></a></div></div><div class="swiper-pagination"></div></div> export default {props: {current: {type: Number,default: 1,},},watch: {current: {handler(new, old) { //翻到了第三頁if (new === 3) {this.initSwiper()}},immediate: true,},},methods: {initSwiper() {new Swiper('.swiper-container', {autoplay: {delay: 2000,stopOnLastSlide: false,disableOnInteraction: false,},loop: true,keyboard: true,mousewheel: true,on: {click: function() {alert('click')},},pagination: {el: '.swiper-pagination',},})}} }

總結

以上是生活随笔為你收集整理的swiper 在turn.js不能滚动的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。