Browse Source

fix: avatar-list-item did not register

Sendya 3 years ago
parent
commit
6cd90b1c54

+ 1 - 1
src/components/AvatarList/Item.jsx

@@ -16,7 +16,7 @@ const Item = {
     warning(getSlotOptions(this.$parent).__ANT_AVATAR_LIST, 'AvatarListItem must be a subcomponent of AvatarList')
   },
   render () {
-    const AvatarDom = <Avatar size={this.$parent.size} src={this.src} />
+    const AvatarDom = <Avatar size={this.$parent.size === 'mini' ? 'small' : this.$parent.size} src={this.src} />
     return this.tips && <Tooltip title={this.tips}>{AvatarDom}</Tooltip> || <AvatarDom />
   }
 }

+ 2 - 2
src/components/AvatarList/List.jsx

@@ -36,9 +36,9 @@ const AvatarList = {
       [`${prefixCls}`]: true,
       [`${size}`]: true
     }
+
     const items = filterEmpty(this.$slots.default)
     const itemsDom = items && items.length ? <ul class={`${prefixCls}-items`}>{this.getItems(items)}</ul> : null
-
     return (
       <div class={className}>
         {itemsDom}
@@ -55,7 +55,7 @@ const AvatarList = {
 
       if (this.maxLength > 0) {
         items = items.slice(0, this.maxLength)
-        items.push((<Avatar size={this.size} style={this.excessItemsStyle}>{`+${totalSize - this.maxLength}`}</Avatar>))
+        items.push((<Avatar size={this.size === 'mini' ? 'small' : this.size} style={this.excessItemsStyle}>{`+${totalSize - this.maxLength}`}</Avatar>))
       }
       return items.map((item) => (
         <li class={className}>{item}</li>

+ 2 - 2
src/views/account/center/page/Project.vue

@@ -12,7 +12,7 @@
           <div class="cardItemContent">
             <span>{{ item.updatedAt | fromNow }}</span>
             <div class="avatarList">
-              <avatar-list size="mini">
+              <avatar-list size="small">
                 <avatar-list-item
                   v-for="(member, i) in item.members"
                   :key="`${item.id}-avatar-${i}`"
@@ -32,7 +32,7 @@
 import moment from 'moment'
 import { TagSelect, StandardFormRow, Ellipsis, AvatarList } from '@/components'
 const TagSelectOption = TagSelect.Option
-const AvatarListItem = AvatarList.AvatarItem
+const AvatarListItem = AvatarList.Item
 
 export default {
   name: 'Project',