我自定義了一個組件,在.wxml中添加了hidden="{{modalHidden}}",在對應(yīng)的js中添加了Component({
properties: {
modalHidden: {//這里定義了modalHidden屬性,屬性值可以在組件使用時指定.寫法為modal-hidden
type: Boolean,
value: true
},
}, data: {
text: "text",
},
methods: { // 跳轉(zhuǎn)
startAnswerButton() {
wx.navigateTo({
url: "XXX"
});
}, //取消
closeReward() { this.setData({
modalHidden: true,
})
}
}
});然后在調(diào)用的.wxml中加入<modal modal-hidden="{{is_modal_hidden}}" modal-msg="{{is_modal_Msg}}" />但是無論是true 還是 false 都會顯示
微信小程序自定義組件顯示隱藏問題
暮色呼如
2019-03-21 14:11:13