catchtouchmove 在小程序模拟器中没有效果,真机测试时可以
使用catchtouchmove=“true”,会一直弹出警告错误“does not have a method “true” to handle event “touchmove”,所以这里定义个方法
<block wx:if="{{showVideo == true}}">
<view class="showVideoBg" catchtouchmove="filterViewMove">
<view>
<video
id="myVideo"
src="video_url"
binderror="videoErrorCallback"
show-center-play-btn='true'
show-play-btn="true"
autoplay="true"
object-fit="cover"
controls
enable-play-gesture="{{true}}"
bindended="closeVideo"
></video>
<image src="/images/close.png" class="close_video" bindtap="closeVideo"></image>
</view>
</view>
</block>
.showVideoBg{
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100vh;
background: black;
}
.showVideoBg view{
width: 100%;
height: 100%;
position: relative;
}
.showVideoBg scroll-view{
width: 100%;
height: 100%;
}
.showVideoBg video{
width: 100%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}
.close_video{
position: absolute;
top: 100rpx;
right: 30rpx;
width: 60rpx;
height: 60rpx !important;
}
js
// 定义页面禁止滚动
filterViewMove: function(){
return;
},