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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
| <template>
| <div class="avatar-list">
| <slot>
| </slot>
| </div>
| </template>
|
| <script>
| import AAvatar from 'ant-design-vue/es/avatar/Avatar'
| import ATooltip from 'ant-design-vue/es/tooltip/Tooltip'
| const Item = {
| name: 'AvatarListItem',
| props: {
| size: {
| type: String,
| required: false,
| default: 'small'
| },
| src: {
| type: String,
| required: true
| },
| tips: {
| type: String,
| required: false
| }
| },
| methods: {
| renderAvatar (h, size, src) {
| return h(AAvatar, {props: {size: size, src: src}}, [])
| }
| },
| render (h) {
| const avatar = this.renderAvatar(h, this.$props.size, this.$props.src)
| return h(
| 'li',
| {class: 'avatar-item'},
| [this.$props.tips ? h(ATooltip, {props: {title: this.$props.tips}}, [avatar]) : avatar]
| )
| }
| }
| export default {
| name: 'AvatarList',
| Item: Item
| }
| </script>
|
| <style lang="less" scoped>
| .avatar-list {
| display: inline-block;
| display: inline-block;
| margin-left: 8px;
| font-size: 0;
| .avatar-item {
| display: inline-block;
| font-size: 14px;
| margin-left: -8px;
| width: 20px;
| height: 20px;
| :global {
| .ant-avatar {
| border: 1px solid #fff;
| width: 20px;
| height: 20px;
| }
| }
| }
| }
| </style>
|
|