uni-app手写弹框modal,点击穿透问题的解决.

928 阅读1分钟

在uni-app项目中,有时点击的模态框的时候,会穿透点击到mask后面的内容,出现页面滚动等异常操作. 解决该问题的核心:@touchmove.stop.prevent="() => {}" 关闭mask的事件冒泡和默认事件.

<view class="mask" @touchmove.stop.prevent="() => {}" >
    <slot />
</view>