微信与uniapp事件阻止冒泡

微信

整个单元格点击进入详情,按钮事件进入操作界面

111

catchtap 阻止冒泡

   <view class="cell_detail" wx:for="{
     
     {weightList}}" wx:key="id" bindtap="goDetailHandler" data-type="{
     
     {item.id}}">
      <!-- 状态 -- 时间 -->
      <view class="cell_top" wx:if="{
     
     {item.shenhe_status == 2}}">
        <text class="status">待修改</text>
<!-- catchtap 事件阻止冒泡 -->
        <button class="status-btn" catchtap="goUpdateHandler" data-type="{
     
     {item.id}}">去修改</button>
      </view>
      <view class="cell_top" wx:elif="{
     
     {item.shenhe_status == 0 || item.shenhe_status == null}}">
        <text class="status" style="color: #1281FB;background-color: #E6F2FF;">待审核</text>
        <button class="status-btn" catchtap="goAuditHandler" data-type="{
     
     {item.id}}">去审核</button>
      </view>
      <view class="cell_top" wx:else>
        <text class="status" style="color: #36C98E;background-color: #ECFFF8;">已审核</text>
      </view>

#uniAPP

@click.native.stop 阻止冒泡

  <view class="bbkh1" @click.native.stop="lookLocation($event)" >
							查看位置
						</view>
// 阻止前往详情事件
			lookLocation(e){
				e.preventDefault(); // 阻止事件冒泡穿透
				console.log('查看位置');
			},

猜你喜欢

转载自blog.csdn.net/Depressiom/article/details/125766234
今日推荐