zj
2024-06-03 5a166725de1adeb7ac2fa5b037abbfc28fedf047
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
import PropTypes from 'ant-design-vue/es/_util/vue-types'
import { Tooltip, Avatar } from 'ant-design-vue'
import { getSlotOptions } from 'ant-design-vue/lib/_util/props-util'
import { warning } from 'ant-design-vue/lib/vc-util/warning'
 
export const AvatarListItemProps = {
  tips: PropTypes.string,
  src: PropTypes.string.def('')
}
 
const Item = {
  __ANT_AVATAR_CHILDREN: true,
  name: 'AvatarListItem',
  props: AvatarListItemProps,
  created () {
    warning(getSlotOptions(this.$parent).__ANT_AVATAR_LIST, 'AvatarListItem must be a subcomponent of AvatarList')
  },
  render () {
    const size = this.$parent.size === 'mini' ? 'small' : this.$parent.size
    const AvatarDom = <Avatar size={size || 'small'} src={this.src} />
    return (this.tips && <Tooltip title={this.tips}>{AvatarDom}</Tooltip>) || <AvatarDom />
  }
}
 
export default Item