先进行了图片循环,如果点击了删除图片的按钮,那么就阻止了事件继续传播
只需在@tap后面加.stop就可以阻止事件继续传播
例子:
<template>
<view class="wai" @tap="waiTab">
<h5>外面</h5>
<view class="nei" @tap="neiTab">
<h5>内部</h5>
</view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
waiTab(){
console.log("点击了外边")
},
neiTab(){
console.log("点击了内部")
}
}
}
</script>
<style>
.wai{
width: 100%;
height: 100px;
display: flex;
justify-content: center;
background-color: #0000FF;
}
.nei{
display: flex;
justify-content: center;
align-items: center;
width: 50px;
height: 50px;
background-color: #00CE47;
}
</style>
@click.stop 阻止点击事件继续传播
<view class="wai" @tap.stop="waiTab">
<h5>外面</h5>
<view class="nei" @tap.stop="neiTab">
<h5>内部</h5>
</view>
</view>
参考: