@click.stop:用于阻止冒泡
@click.stop 標(biāo)簽范圍內(nèi),點(diǎn)擊任何區(qū)域(包括 @click 點(diǎn)擊事件)都不會(huì)關(guān)閉彈窗。標(biāo)簽范圍外會(huì)關(guān)閉彈窗
@click.stop 標(biāo)簽內(nèi)的 @click 等事件:如果事件內(nèi)有關(guān)閉彈窗的代碼可關(guān)閉彈窗文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-732742.html
在 template 中
<view class="pop-box" v-if="showPop" @touchmove.stop.prevent="toMoveHandle" @click="showPop = false">
<view @click.stop>
彈窗內(nèi)容
</view>
</view>
<view @click="showPop = true">打開(kāi)彈窗</view>
在?script 中
data() {
return {
showPop: false,
}
}
toMoveHandle 方法請(qǐng)查看:uniapp 禁止遮罩層下的頁(yè)面滾動(dòng)文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-732742.html
在?style 中
.pop-box {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.4);
z-index: 999;
}
到了這里,關(guān)于uni-app 點(diǎn)擊蒙版層時(shí)關(guān)閉自定義彈窗的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!