index.axml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <view
  2. class="ant-tab-bar {{ className || '' }}"
  3. style="{{ style || '' }}">
  4. <view class="ant-tab-bar-wrap">
  5. <block
  6. a:for="{{ items }}"
  7. a:for-index="index"
  8. a:for-item="item">
  9. <view
  10. class="ant-tab-bar-item {{ index === mixin.value ? 'ant-tab-bar-item-active ' + (activeClassName || '') : '' }}"
  11. style="{{ index === mixin.value ? activeStyle || '' : '' }}"
  12. onTap="onChange"
  13. data-index="{{ index }}">
  14. <ant-badge
  15. a:if="{{ item.badge }}"
  16. type="{{ item.badge.type || 'dot' }}"
  17. text="{{ item.badge.text }}"
  18. stroke="{{ item.badge.stroke }}"
  19. bgColor="{{ item.badge.bgColor }}"
  20. position="{{ item.badge.position || 'top-right' }}"
  21. offsetX="{{ item.badge.offsetX || '-9px' }}"
  22. offsetY="{{ item.badge.offsetY || '0px' }}">
  23. <slot
  24. name="icon"
  25. active="{{ mixin.value == index }}"
  26. item="{{ item }}"
  27. index="{{ index }}">
  28. <image-icon
  29. className="ant-tab-bar"
  30. image="{{ mixin.value === index ? item.activeIcon : item.icon }}" />
  31. </slot>
  32. </ant-badge>
  33. <block a:else>
  34. <slot
  35. name="icon"
  36. active="{{ mixin.value == index }}"
  37. item="{{ item }}"
  38. index="{{ index }}">
  39. <image-icon
  40. className="ant-tab-bar"
  41. image="{{ mixin.value === index ? item.activeIcon : item.icon }}" />
  42. </slot>
  43. </block>
  44. <view class="ant-tab-bar-text-wrap">
  45. <slot
  46. name="text"
  47. active="{{ mixin.value === index }}"
  48. item="{{ item }}"
  49. index="{{ index }}">
  50. <!-- display: inline -->
  51. <text class="ant-tab-bar-text">{{ item.text }}</text>
  52. </slot>
  53. </view>
  54. </view>
  55. </block>
  56. </view>
  57. </view>