You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

34 lines
620 B

  1. <template>
  2. <view
  3. :class="[size, round ? 'round' : '', radius ? 'radius' : '', color ? 'bg-' + color : '', className]"
  4. :style="rootStyle"
  5. class="cu-avatar"
  6. >
  7. <slot></slot>
  8. <slot name="badge"></slot>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. name: 'l-avatar',
  14. props: {
  15. src: {},
  16. size: { default: 'df' },
  17. round: {},
  18. radius: {},
  19. color: {}
  20. },
  21. computed: {
  22. rootStyle() {
  23. return this.getStyle({
  24. backgroundImage: this.src ? 'url(' + this.src + ')' : null,
  25. backgroundColor: this.color || this.src ? null : '#ccc'
  26. })
  27. }
  28. }
  29. }
  30. </script>