avatar.wxml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <wxs src="./avatar.wxs" module="this" />
  2. <view class="{{classPrefix}}__wrapper {{prefix}}-class" style="{{this.getStyles(isShow, zIndex)}}">
  3. <view
  4. class="{{this.getAvatarOuterClass(classPrefix, size, shape)}} border--{{borderSize}} {{prefix}}-class-image "
  5. style="{{this.getAvatarSizePx(size)}}"
  6. >
  7. <t-image
  8. wx:if="{{image}}"
  9. class="{{prefix}}-image"
  10. t-class-load="{{prefix}}-class-alt"
  11. t-class="{{classPrefix}}__image"
  12. src="{{image}}"
  13. mode="aspectFill"
  14. binderror="onLoadError"
  15. loadFailed="{{alt}}"
  16. />
  17. <view
  18. wx:elif="{{icon}}"
  19. class="{{classPrefix}}__icon {{this.getIconClass(classPrefix, size)}} {{prefix}}-class-icon"
  20. >
  21. <t-icon name="{{icon}}" />
  22. </view>
  23. <view wx:else class="{{classPrefix}}__text {{prefix}}-class-content">
  24. <slot />
  25. </view>
  26. </view>
  27. <t-badge
  28. class="{{prefix}}-badge-host {{prefix}}-badge__{{shape === 'circle' ? 'circle' : 'round'}}"
  29. wx:if="{{badgeProps.dot || badgeProps.count}}"
  30. color="{{badgeProps.color}}"
  31. count="{{badgeProps.count}}"
  32. max-count="{{badgeProps.maxCount || 100}}"
  33. dot="{{badgeProps.dot}}"
  34. content="{{badgeProps.content}}"
  35. size="{{badgeProps.size}}"
  36. visible="{{badgeProps.visible}}"
  37. offset="{{badgeProps.offset}}"
  38. />
  39. </view>