npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tanzhenxing/zx-avatar-group

v1.0.5

Published

uni-app 头像组组件

Readme

zx-avatar-group 头像组组件

介绍

本组件一般用于展示头像组的场景,如个人中心、评论列表页的用户头像展示等场所。支持设置头像大小、形状、数量限制以及点击查看更多功能。

基本用法

<template>
  <zx-avatar-group :urls="avatarList" size="70" shape="circle"></zx-avatar-group>
</template>

<script setup>
const avatarList = [
  'https://example.com/avatar1.jpg',
  'https://example.com/avatar2.jpg',
  'https://example.com/avatar3.jpg',
  'https://example.com/avatar4.jpg',
  'https://example.com/avatar5.jpg',
  'https://example.com/avatar6.jpg'
];
</script>

对象数组用法

当传入的是对象数组时,可以通过 keyName 属性指定使用对象中的哪个属性作为头像地址:

<template>
  <zx-avatar-group :urls="userList" keyName="avatar" size="60"></zx-avatar-group>
</template>

<script setup>
const userList = [
  { id: 1, name: '用户1', avatar: 'https://example.com/avatar1.jpg' },
  { id: 2, name: '用户2', avatar: 'https://example.com/avatar2.jpg' },
  { id: 3, name: '用户3', avatar: 'https://example.com/avatar3.jpg' }
];
</script>

自定义样式

<template>
  <zx-avatar-group 
    :urls="avatarList" 
    size="80" 
    shape="square" 
    :maxCount="4" 
    :gap="0.3"
    @showMore="handleShowMore"
  ></zx-avatar-group>
</template>

<script setup>
const avatarList = ['https://example.com/avatar1.jpg', 'https://example.com/avatar2.jpg', 
  'https://example.com/avatar3.jpg', 'https://example.com/avatar4.jpg', 
  'https://example.com/avatar5.jpg', 'https://example.com/avatar6.jpg'];

const handleShowMore = () => {
  // 处理查看更多逻辑
  console.log('查看更多头像');
};
</script>

API

属性

| 属性名 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | urls | Array | [] | 头像图片组,可以是图片地址字符串数组,也可以是对象数组 | | maxCount | String/Number | 5 | 最多展示的头像数量 | | shape | String | 'circle' | 头像形状,可选值:'circle'(圆形), 'square'(方形) | | mode | String | 'scaleToFill' | 图片裁剪模式 | | showMore | Boolean | true | 超出maxCount时是否显示查看更多的提示 | | size | String/Number | 80 | 头像大小,单位rpx | | keyName | String | '' | 当urls为对象数组时,指定从对象中读取哪个属性作为图片地址 | | gap | String/Number | 0.5 | 头像之间的遮挡比例,取值范围0-1,0.5表示遮挡50% | | extraValue | String/Number | '' | 需额外显示的值,用于自定义+N中的N值 |

事件

| 事件名 | 说明 | 回调参数 | | --- | --- | --- | | showMore | 点击查看更多头像时触发 | - |

注意事项

  1. urls 为对象数组时,若不设置 keyName,则默认尝试读取对象中的 url 属性
  2. gap 属性控制头像之间的重叠程度,值越小重叠越少,值为0则无重叠
  3. 当实际头像数量超过 maxCount 或设置了 extraValue 且大于0时,最后一个头像会显示 +N 的提示
  4. 可以通过监听 showMore 事件实现自定义的展示更多头像的逻辑