解决微信小程序穿透事件&&不影响弹出层滚动事件

情况一、弹出层无滚动事件
弹出层加catchtouchmove=“return”

<view class="box" catchtouchmove="return"> 
//略
</view>

情况二、弹出框也有滚动事件
在这里插入图片描述

源码:

<view class="page">
	<view wx:for="{{tableData}}" wx:key="index" wx:for-item="item">
		<view style="background-color: blanchedalmond; width: 100vh;height: 300rpx;margin-bottom: 20rpx;">{{index}}</view>
	</view>
	<scroll-view class="page_box myLive1" scroll-y bindtouchstart="left_scroll0" bindtouchend="left_scroll" catchtouchmove="doNothing">
		<view class="my_box1">
			<view wx:for="{{tableData}}" wx:key="index" wx:for-item="item">
				<view style="background-color: red; width: 30vh;height: 100rpx;margin-bottom: 20rpx;"> {{index}}</view>
			</view>
		</view>
	</scroll-view>
</view>
Page({
  data: {
	tableData: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
  }
})
.page_box{
	position: fixed;
	top: 5vh;
	right: 0;
	z-index: 1001;
}
.myLive1 {
	height: 70vh;
	width: 26vw;
	margin-left: 4vw;
}
.my_box1 {
	display: flex;
	flex-direction: column;
	background: rgba(0, 0, 0, .6);
	border-radius: 0 0 0 10rpx;
}

版权声明:本文为weixin_40030173原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。