html
<view class="wrong-rate">
<view class="wr-title">2019年08月29日</view>
<view class="{{!showMore? 'hiddenmore' : 'showmore'}}">
<view wx:for="{{rankList}}" wx:for-item="item" wx:for-index="idx" wx:key="" class="wr-list {{idx>1 ? 'more-item' : ''}}">
<view>知识点1错误率({{item.percentage0}}%),共{{item.amount}}人</view>
<view>其中:概念题错误率({{item.percentage1}}%)</view>
<view>其中:基础题错误率({{item.percentage2}}%)</view>
<view>其中:综合题错误率({{item.percentage3}}%)</view>
</view>
</view>
<block wx:if="{{rankList.length>2}}">
<view wx:if="{{showMore}}" class='' bindtap='listToggle'>
<image style='background:red;width:38rpx;height:31rpx;transform:rotate(180deg);' src="../../image/箭头s.png"></image>
</view>
<view wx:else class='' bindtap='listToggle'>
<image style='background:red;width:38rpx;height:31rpx;' src="../../image/箭头.png"></image>
</view>
</block>
</view>
css
.wrong-rate {
text-align: center;
}
.wr-title {
margin-bottom: 20rpx;
}
.wr-list {
font-size: 30rpx;
line-height: 50rpx;
margin-bottom: 20rpx;
}
.hiddenmore .more-item {
display: none;
}
js
Page({
data:{
showMore: false,
rankList: [
{
amount: 9.37,
percentage0: 30,
percentage1: 30,
percentage2: 30,
percentage3: 30
},
{
amount: 9.38,
percentage0: 10,
percentage1: 10,
percentage2: 10,
percentage3: 10
},
{
amount: 9.39,
percentage0: 20,
percentage1: 20,
percentage2: 30,
percentage3: 30
},
],//这里面的数据是我写死的数据,应该要通过请求获取的
},
listToggle: function () {
this.setData({
showMore: !this.data.showMore
})
}
})