bd3cca0c29a6a0f1e2f90603fa8616f0af10d544.svn-base 866 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <template>
  2. <tooltip v-if="tips !== ''">
  3. <template slot="title">{{ tips }}</template>
  4. <avatar :size="avatarSize" :src="src" />
  5. </tooltip>
  6. <avatar v-else :size="avatarSize" :src="src" />
  7. </template>
  8. <script>
  9. import Avatar from 'ant-design-vue/es/avatar'
  10. import Tooltip from 'ant-design-vue/es/tooltip'
  11. export default {
  12. name: "AvatarItem",
  13. components: {
  14. Avatar,
  15. Tooltip
  16. },
  17. props: {
  18. tips: {
  19. type: String,
  20. default: '',
  21. required: false
  22. },
  23. src: {
  24. type: String,
  25. default: ''
  26. }
  27. },
  28. data () {
  29. return {
  30. size: this.$parent.size
  31. }
  32. },
  33. computed: {
  34. avatarSize () {
  35. return this.size !== 'mini' && this.size || 20
  36. }
  37. },
  38. watch: {
  39. '$parent.size' (val) {
  40. this.size = val
  41. }
  42. }
  43. }
  44. </script>