side-bar-item.wxml 1.0 KB

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