--------------------------------page.json--------------------------------
{
"usingComponents": {
"mp-navigation-bar": "weui-miniprogram/navigation-bar/navigation-bar",
"mp-toptips": "weui-miniprogram/toptips/toptips"
},
"navigationStyle": "custom"
}
--------------------------------以下是wxml--------------------------------
<view class="page">
<button class="weui-btn" type="primary" bindtap="tapErrShow">显示/隐藏error</button>
<mp-toptips msg="{{errorMsg}}" type="error" show="{{errorShow}}"></mp-toptips>
</view>
--------------------------------以下是js逻辑--------------------------------
Page({
data: {
errorMsg: '',
errorShow: false,
},
tapErrShow() {
console.log(this.data.errorShow)
this.setData({
errorShow: !this.data.errorShow,
})
if(this.data.errorShow){
this.setData({
errorMsg: '这是一个错误提示'
})
}else{
this.setData({
errorMsg: ''
})
}
console.log(this.data.errorMsg)
},
})
请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
请提供代码片段方便调试