最多写出这样一个表格,排序是不会,求大佬解答
<view class="table">
<view class="tr bg-w">
<view class="th" bindtap="sortT">Time</view>
<view class="th">Status</view>
<view class="th ">Method</view>
</view>
<block wx:for="{{listData}}" wx:key="{{time}}">
<view class="tr bg-g" wx:if="{{index % 2 == 0}}">
<view class="td">{{item.time}}</view>
<view class="td">{{item.status}}</view>
<view class="td">{{item.method}}</view>
</view>
<view class="tr" wx:else>
<view class="td">{{item.time}}</view>
<view class="td">{{item.status}}</view>
<view class="td">{{item.method}}</view>
</view>
</block>
</view>
.table {
border: 0px solid darkgray;
padding: 20rpx 10rpx;
}
.tr {
display: flex;
width: 100%;
justify-content: center;
height: 3rem;
align-items: center;
}
.td {
width:50%;
justify-content: center;
text-align: center;
}
.bg-w{
background: #0089dd;
opacity: 0.6;
}
.bg-g{
background: #E6F3F9;
}
.th {
width: 50%;
justify-content: center;
background: #0089bb;
color: #fff;
display: flex;
height: 3rem;
align-items: center;
}
Page({
data:{
listData: [
{ "time": "time1", "status": "status1", "method": "method1" },
{ "time": "time2", "status": "status2", "method": "method2" },
{ "time": "time3", "status": "status3", "method": "method3" },
{ "time": "time4", "status": "status4", "method": "method4" },
{ "time": "time5", "status": "status5", "method": "method5" },
{ "time": "time6", "status": "status6", "method": "method6" }
]
},
onLoad: function () {
console.log('onLoad')
},
onShow(){
},
sortT:function (e) {
}
})