分类可水平滚动
view部分
<scroll-view class="scroll-x paramWrap1" scroll-x="true" scroll-x>
<view>
<text bindtap='param1Change' data-state='-1' class='{{examType==-1?"pvts":""}}'>全部</text>
</view>
<view wx:for="{{examTypes}}">
<text bindtap='param1Change' data-state='{{item.id}}' class='{{examType==item.id?"pvts":""}}'>{{item.name}}</text>
</view>
</scroll-view>
css部分
.scroll-x{
white-space:nowrap;
display:flex;
border-bottom: 2rpx solid #eee;
font-size: 28rpx;
color: #4c4c4c;
}
.scroll-x view{
display: inline-block;
}
.paramWrap1 {
border-bottom: 2rpx solid #eee;
}
.paramWrap1 view {
flex: 1;
text-align: center;
}
.paramWrap1 view text {
border-bottom: 2rpx solid #fff;
box-sizing: border-box;
display: inline-block;
padding-top: 30rpx;
padding-bottom: 20rpx;
width: 100%;
font-size: 30rpx;
color: #6e6e6e;
padding-left: 24rpx;
padding-right: 24rpx;
}
text.pvts {
border-color: #2cc17b !important;
color: #2cc17b!important;
}
.paramWrap1 view.active{
color: #02bd76;
}
js部分
param1Change: function (e) {
var state = parseInt(e.currentTarget.dataset["state"]);
this.setData({
examType: state
});
this.examPaperPageReset();
},