index.axml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <import-sjs
  2. from="./index.sjs"
  3. name="_sjs" />
  4. <view
  5. class="ant-badge {{ className || '' }}"
  6. style="{{ style }}">
  7. <view class="ant-badge-body">
  8. <slot />
  9. </view>
  10. <view
  11. a:if="{{ type === 'dot' }}"
  12. class="ant-badge-content"
  13. style="{{ _sjs.setPositionStyle(position, offsetX, offsetY) }}">
  14. <view
  15. class="ant-badge-dot {{ stroke ? 'ant-badge-dot-stroke' : '' }}"
  16. style="{{ bgColor ? 'background-color: ' + bgColor + ';' : '' }}" />
  17. </view>
  18. <view
  19. a:else
  20. class="ant-badge-content ant-badge-content-not-dot {{ type === 'bubble' ? 'ant-badge-content-' + position + '-bubble' : '' }} {{ stroke ? 'ant-badge-content-stroke' : '' }}"
  21. style="{{ bgColor ? 'background-color: ' + bgColor + ';' : '' }} {{ _sjs.setBubbleStyle(type, position) }};{{ _sjs.setPositionStyle(position, offsetX, offsetY) }}">
  22. <view class="ant-badge-icon-container" />
  23. <view class="ant-badge-content-text">
  24. <slot name="text">
  25. <view
  26. a:if="{{ type === 'number' }}"
  27. class="ant-badge-number">
  28. <!-- display: inline -->
  29. <text a:if="{{ _sjs.getOverCount(text) }}">99+</text>
  30. <!-- display: inline -->
  31. <text a:else>{{ text }}</text>
  32. </view>
  33. <view
  34. a:if="{{ type === 'text' }}"
  35. class="ant-badge-text">
  36. {{ text }}
  37. </view>
  38. <view
  39. a:if="{{ type === 'bubble' }}"
  40. class="ant-badge-bubble">
  41. {{ text }}
  42. </view>
  43. </slot>
  44. </view>
  45. </view>
  46. </view>