为什么swiper在真机调试上左右滑动监测不到,而且video的点击事件也失效了 但是小程序内可以使用的
代码:
<swiper class="swiper" :style="{height:zheight + 'px'}" :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval" :duration="duration" :vertical="vertical" :easing-function="easingfunction" @change="changeVideo" :current="current" @touchstart="start" @touchend="end">
<swiper-item v-for="(item, key) in video_list" :key="key" :style="{height:zheight + 'px'}">
<view class="swiper-item uni-bg-red">
<cover-image
class="play" v-if="show_play"
@tap="videoPlay"
src="/static/play_1.png"></cover-image>
<video
:src="item.video"
preload
loop="true"
controls="false"
:id="'video'+item.video_id"
objectFit="fill"
:enable-progress-gesture="false"
@tap="clickVideo"
ref="video_url"
play-btn-position="center"
class="video"
:poster="item.cover_url"
@timeupdate="timeupdate"
:style="{height:zheight + 'px'}">
</video>
</view>
</swiper-item>
</swiper>
js代码:
start(e){
this.clientX=e.changedTouches[0].clientX;
this.clientY=e.changedTouches[0].clientY;
},
end(e){
var _this = this;
const subX=e.changedTouches[0].clientX - _this.clientX;
const subY=e.changedTouches[0].clientY - _this.clientY;
if(subY>50 || subY<-50){
console.log('上下滑')
}else{
if(subX>50){
console.log('右')
}else if(subX<-50){
console.log('左')
}else{
console.log('无效')
}
}
}
这样写应该没啥问题吧?
2 个回复
空巷 (作者)
有大神知道为什么吗?
空巷 (作者)
而且swiper滑动还会卡顿 有时只会滑动一半
7***@qq.com
怎么搞得。弄好了吗?大哥
2021-03-29 19:18