Body:

Here the main use of swiper components and three operations, directly on the code, style only three classes, simple and rough, lazy friends can be directly used, like a point of support

<view> <view class="swiper-tab"> <view class="bre swiper-tab-list {{tab==0 ? </view> <view class="swiper-tab-list {{TAB ==1? 'on' : }}" data-current="1" bindtap="tab_click"> </view> </view> <swiper current="{{TAB}}" class="swiper-box" Duration ="300" style="height:{{winheight-31}}px" bindchange="tab_slide"> </swiper-item> <swiper-item> Product parameters </swiper-item> </swiper> </view>Copy the code
Page({data: {TAB: 0}, tab_slide: function (e) {var that = this; that.setData({ tab: e.detail.current }); }, tab_click: function (e) {var that = this; if (that.data.tab === e.target.dataset.current) { return false; } else { that.setData({ tab: e.target.dataset.current }) } }, })Copy the code
.swiper-tab{  
    width: 100%;  
    border-bottom: 2rpx solid #eee;  
    text-align: center;  
    line-height: 80rpx;
    background: #fff;
    font-size: 14px;
}  
.on{ 
  color: #dd2727;  
  border-bottom: 5rpx solid #dd2727;
}  
.swiper-tab-list{  
  font-size: 29rpx;  
    display: inline-block;  
    width: 49.5%;  
    color: #333; 
}
Copy the code