就上图一样的切换
直接上代码:
WXML代码:
</view>
<view class='no_order' catchtap='get_noorder' style='border-bottom: solid 2px {{okgroundColor}}'>
<text>未完成订单</text>
</view>
<view class='no_order' catchtap='get_okorder' style='border-bottom: solid 2px {{nogroundColor}}'>
<text>历史订单</text>
</view>
JS代码:
get_okorder: function () {//这个是已完成订单
var _this = this;
var noColor = this.data.okgroundColor == '#fff' ? '#64c2bb' : '#64c2bb';
var okColor = this.data.nogroundColor == '#64c2bb' ? '#fff' : '#fff';
var _this = this;
this.setData({
okgroundColor: okColor,
nogroundColor: noColor
});
get_noorder: function () {//这个是未完成订单
var okColor = this.data.okgroundColor == '#fff' ? '#64c2bb' : '#64c2bb';
var noColor = this.data.nogroundColor == '#64c2bb' ? '#fff' : '#fff';
var _this = this;
this.setData({
okgroundColor: okColor,
nogroundColor: noColor
});