side-bar-item.wxml 1.1 KB

12345678910111213141516171819202122232425
  1. <import src="../common/template/badge" />
  2. <import src="../common/template/icon" />
  3. <wxs src="../common/utils.wxs" module="_" />
  4. <view
  5. id="{{tId}}"
  6. class="{{_.cls(classPrefix, [['active', active], ['disabled', disabled]])}} class {{prefix}}-class"
  7. style="{{_._style([style, customStyle])}}"
  8. bind:tap="handleClick"
  9. aria-role="button"
  10. aria-label="{{ active ? '已选中,' + label : label}}"
  11. aria-label="{{ ariaLabel || (badgeProps.dot || badgeProps.count ? (active ? '已选中,' + label + _.getBadgeAriaLabel({ ...badgeProps }) : label + _.getBadgeAriaLabel({ ...badgeProps })) : '') }}"
  12. aria-disabled="{{disabled}}"
  13. >
  14. <block wx:if="{{active}}">
  15. <view class="{{classPrefix}}__line"></view>
  16. <view class="{{classPrefix}}__prefix"></view>
  17. <view class="{{classPrefix}}__suffix"></view>
  18. </block>
  19. <template wx:if="{{_icon}}" is="icon" data="{{ tClass: classPrefix + '__icon', ..._icon }}" />
  20. <block wx:if="{{badgeProps}}">
  21. <template is="badge" data="{{ ...badgeProps, content: label }}" />
  22. </block>
  23. <block wx:else>{{label}}</block>
  24. </view>