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