Skip to content

AvatarList

A group of user avatars, commonly used in project/team member lists. You can set the size and also limit the maximum number of avatars displayed.

Basic

The data parameter is an array of objects. Each object needs to have one property, which defaults to url, used to display the image.
vue
<template>
  <epp-avatar-list :data="list" indent="-10px" />
</template>
<script lang="ts" setup>
import { ref } from 'vue';

const list = ref([
  {
    url: 'https://png.pngtree.com/png-clipart/20190520/original/pngtree-vector-users-icon-png-image_4144740.jpg',
  },
  {
    url: 'https://png.pngtree.com/png-clipart/20190614/original/pngtree-female-avatar-vector-icon-png-image_3725439.jpg',
    title: 'Avatar 2',
  },
  {
    url: 'https://png.pngtree.com/png-clipart/20190614/original/pngtree-male-student-icon-png-image_3728104.jpg',
    title: 'Avatar 3',
  },
  {
    url: 'https://png.pngtree.com/png-clipart/20190924/original/pngtree-human-avatar-free-vector-png-image_4825373.jpg',
    title: 'Avatar 4',
  },
]);
</script>

Maximum Value Setting

3
You can configure the key for the url property using the url-field prop.
vue
<template>
  <epp-avatar-list :data="list" :max="5" url-field="img">
    <template #tip="{ item }">
      <h5>Name:{{ item.name }}</h5>
    </template>
  </epp-avatar-list>
</template>
<script lang="ts" setup>
import { ref } from 'vue';

const list = ref([
  {
    img: 'https://png.pngtree.com/png-clipart/20190520/original/pngtree-vector-users-icon-png-image_4144740.jpg',
    name: 'Jack',
  },
  {
    img: 'https://png.pngtree.com/png-clipart/20190614/original/pngtree-female-avatar-vector-icon-png-image_3725439.jpg',
    name: 'Musk',
  },
  {
    img: 'https://png.pngtree.com/png-clipart/20190614/original/pngtree-male-student-icon-png-image_3728104.jpg',
    name: 'Mary',
  },
  {
    img: 'https://png.pngtree.com/png-clipart/20190924/original/pngtree-human-avatar-free-vector-png-image_4825373.jpg',
    name: 'Tom',
  },
  {
    img: 'https://png.pngtree.com/png-clipart/20190520/original/pngtree-vector-users-icon-png-image_4144740.jpg',
    name: 'Dog',
  },
  {
    img: 'https://png.pngtree.com/png-clipart/20190614/original/pngtree-female-avatar-vector-icon-png-image_3725439.jpg',
    name: 'Cat',
  },
  {
    img: 'https://png.pngtree.com/png-clipart/20190614/original/pngtree-male-student-icon-png-image_3728104.jpg',
    name: 'Banana',
  },
  {
    img: 'https://png.pngtree.com/png-clipart/20190924/original/pngtree-human-avatar-free-vector-png-image_4825373.jpg',
    name: 'Pear',
  },
]);
</script>

Attributes

ParameterDescriptionTypeOptional ValuesDefault Value
dataData listRecord<string, any>[][]
indentThe overlapping distance between images, can be various CSS unitsstring-图片宽度一半的负值
popover-propsPopover properties, see Element Plus Popover documentationstring--
sizeImage sizenumber / string参考Element Plus Avatar 组件参数default
shapeImage shapestring参考Element Plus Avatar 组件参数circle
fitDetermines how the image fits within its container box, same as native object-fitstringfill / contain / cover / none / scale-downcover
maxThe maximum number of avatars to display. If exceeded, a remainder will be shown at the endnumber-
max-bg-colorBackground color of the remainder valuestringblack
url-fieldData object configuration item, specifies the key for the image URL propertystringurl

Slots

NameDescription
tipTooltip information, the parameter is the corresponding object in the data: item

Events

Event NameDescriptionCallback Parameter
clickImage click eventThe corresponding object in data