案例演示:
代码:
事件源:
<view @click="open(showValue)">点击调起弹框</view>
<!-- 弹框 -->
<u-popup :show="isShow" @close="close" @open="open()" round="30rpx"></u-popup>
data() {
return {
isShow: false,
// 0不显示 1显示
showValue: 0
}
},
method:{
open(e) {
if (e == 0) {
// 如果当前不显示,那么让他显示,提前把值改掉 下一次再点的时候再进行判断
this.isShow = true
this.showValue = 1
}
if (e == 1) {
this.isShow = false
this.showValue = 0
}
},
close() {
this.isShow = false
this.showValue = 0
},
}