TabBar.wxml 1.21 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}}">
        <text id="tab-{{index}}">
          <text class="tab-item-text">{{item.text || item }}</text><text wx:if="{{item.count >= 0}}" style="font-size: var(--fontSize20);">({{item.count}})</text>
        </text>
      </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?'#2C66F7':''}};" -->
      <view class="tab-item {{tabIndex==index?'active':''}}" bindtap="change" data-index="{{index}}">
        <text id="tab-{{index}}"><text class="tab-item-text">{{item.text || item }}</text><text wx:if="{{item.count >= 0}}" style="font-size: var(--fontSize20);">({{item.count}})</text></text>
      </view>
    </block>
  </view>
</block>