TabBar.wxml 1.34 KB
<block wx:if="{{scroll}}">
  <scroll-view class=" scroll" scroll-x enable-flex scroll-with-animation scroll-into-view="{{to}}">
    <block wx:for="{{tabList}}" wx:key="index">
      <view class="tab-item {{tabIndex==index?'active':''}}" bindtap="change" data-index="{{index}}" id="to-{{index}}">
        <view id="tab-{{index}}" class="text-item">
          <view class="tab-item-text">{{item.text || item }}</view><view wx:if="{{item.count >= 0}}" style="font-size: var(--fontSize20);">{{item.count > 99 ? '99+' : item.count}}</view>
        </view>
      </view>
    </block>
    <!-- <view class="active-doc" style="{{activeStyle}}" /> -->
  </scroll-view>
</block>
<block wx:else>
  <view class="tab" style="grid-template-columns: repeat({{tabList.length}}, 1fr);font-size:{{tabList.length>5?'var(--fontSize24)':''}} ;">
    <block wx:for="{{tabList}}" wx:key="index">
      <!-- style="color:{{tabIndex==index?'#347BFF':''}};" -->
      <view class="tab-item {{tabIndex==index?'active':''}}" bindtap="change" data-index="{{index}}">
        <view id="tab-{{index}}" class="text-item"><view class="tab-item-text">{{item.text || item }}</view><view wx:if="{{item.count >= 0}}" style="font-size: var(--fontSize20);">{{item.count > 99 ? '99+' : item.count}}</view></view>
      </view>
    </block>
    <view class="active-doc" style="{{activeStyle}}" />
  </view>
</block>