弹出框点击确认让内容隐藏。

发布于 6 年前作者 longjuan14337 次浏览最后编辑 6 年前来自 ask

wx.showModal

的弹窗点击确认让一块view内容隐藏。

跪求大神帮解决。

1 回复
xxie
xxie1 楼5 年前

Wxml:

<view wx:if=‘{{!hiddenView}}’>要隐藏的</view>

<button bindtap=‘showMyModal’>打开弹窗</button>

Js:

data: {

//hiddenView初始为假

hiddenView: false

},

showMyModal(){

var that = this

wx.showModal({

title: ‘标题’,

content: ‘内容’,

success: function(res) {

//如果是点击的确定,设置hiddenView为真

if(res.confirm){

that.setData({

hiddenView : true

})

}

},

fail: function(res) {},

complete: function(res) {},

})

},