Blame view

ant-design-vue-jeecg/src/components/AvatarList/Item.vue 791 Bytes
肖超群 authored
1
2
3
<template>
  <tooltip v-if="tips !== ''">
    <template slot="title">{{ tips }}</template>
肖超群 authored
4
    <avatar :size="avatarSize" :src="src"/>
肖超群 authored
5
  </tooltip>
肖超群 authored
6
  <avatar v-else :size="avatarSize" :src="src"/>
肖超群 authored
7
8
9
</template>

<script>
肖超群 authored
10
11
import Avatar from 'ant-design-vue/es/avatar'
import Tooltip from 'ant-design-vue/es/tooltip'
肖超群 authored
12
肖超群 authored
13
14
15
16
17
18
19
20
21
22
23
export default {
  name: "AvatarItem",
  components: {
    Avatar,
    Tooltip
  },
  props: {
    tips: {
      type: String,
      default: '',
      required: false
肖超群 authored
24
    },
肖超群 authored
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
    src: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      size: this.$parent.size
    }
  },
  computed: {
    avatarSize() {
      return this.size !== 'mini' && this.size || 20
    }
  },
  watch: {
    '$parent.size'(val) {
      this.size = val
肖超群 authored
43
44
    }
  }
肖超群 authored
45
}
肖超群 authored
46
</script>