index.wxml 1.1 KB

123456789101112131415161718192021
  1. <view class="cat-tabbar">
  2. <view class="cat-tabbar__wrapper" style="{{fixed ? 'position: fixed;' : ''}}">
  3. <block wx:for="{{ tabs }}" wx:for-index="index" wx:key="index" wx:for-item="item">
  4. <view class="cat-tabbar__item" bindtap="changeTab">
  5. <!--判断是否图片图标-->
  6. <block wx:if="{{ item.icon }}">
  7. <view class="cat-icon {{['cat-icon-' + item.name, active === index ? 'active' : '']}}">
  8. <image class="image" src="{{ item.icon.active }}" wx:if="{{ active === index }}"></image>
  9. <image class="image" src="{{ item.icon.inactive }}" wx:else></image>
  10. <text class="text">{{ item.label }}</text>
  11. </view>
  12. </block>
  13. <block wx:else>
  14. <view class="cat-icon {{['cat-icon-' + item.name, active === index ? 'active' : '']}}">
  15. <text class="text">{{ item.label }}</text>
  16. </view>
  17. </block>
  18. </view>
  19. </block>
  20. </view>
  21. </view>