弹出框点击确认让内容隐藏。
发布于 5 年前 作者 longjuan 14156 次浏览 来自 问答

wx.showModal

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

跪求大神帮解决。

1 回复

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) {},

})

},

回到顶部