index.wxml 1.2 KB

123456789101112131415161718192021222324
  1. <view class="weui-tabs">
  2. <view class="weui-tabs-bar__wrp">
  3. <!-- scroll-left="{{scrollLeft}}" scroll-into-view="item_{{currentView}}" -->
  4. <scroll-view scroll-x="true" scroll-left="{{scrollLeft}}" scroll-with-animation="{{animation}}">
  5. <view class="weui-tabs-bar__content">
  6. <block wx:for="{{tabs}}" wx:key="title">
  7. <view id="item_{{index}}" class="weui-tabs-bar__item"
  8. style="background-color: {{tabBackgroundColor}}; color: {{activeTab === index ? tabActiveTextColor : tabInactiveTextColor}};"
  9. bindtap="handleTabClick" data-index="{{index}}">
  10. <view class="weui-tabs-bar__title {{tabClass}} {{activeTab === index ? activeClass : ''}}"
  11. style="border-bottom-color: {{activeTab === index ? tabUnderlineColor : 'transparent'}}">
  12. <text class="">{{item.title}}</text>
  13. </view>
  14. </view>
  15. </block>
  16. </view>
  17. </scroll-view>
  18. </view>
  19. <swiper class="{{swiperClass}}" current="{{activeTab}}" duration="{{duration}}" bindchange="handleSwiperChange">
  20. <swiper-item wx:for="{{tabs}}" wx:key="title">
  21. <slot name="tab-content-{{index}}"></slot>
  22. </swiper-item>
  23. </swiper>
  24. </view>