wxml:
<view >
<button class="{{showView?'show':'hide'}}" bindtap="change">{{showView?'隐藏':'显示'}}</button>
<button class="{{showView?'hide':'show'}}" bindtap="change">{{showView?'隐藏':'显示'}}</button>
</view>
<view class="{{showView?'show':'hide'}}">
<text class="text">隐藏控件</text>
</view>
wxss:
.hide{
display: none;
}
.show{
display: block;
}
js:
data: {
showView: true
},
onLoad: function (options) {
showView: (options.showView == "true" ? true : false)
},
change: function () {
var that = this;
that.setData({
showView: (!that.data.showView)
})
},