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-tabbar

v1.0.12

Published

zx-tabbar 底部导航栏

Readme

zx-tabbar 底部导航栏

此组件提供了自定义 tabbar 的能力,支持 H5、小程序、App,适合多端项目使用。

组件特性

  • 支持自定义图标、文本、徽标、圆点
  • 支持固定底部、占位防塌陷
  • 支持安全区适配
  • 支持拦截切换、事件回调
  • 兼容多端(H5/小程序/App)

基本用法

<template>
  <zx-tabbar :value="tab" @change="tab = $event" :items="tabbarList" />
</template>
<script setup>
import { ref } from 'vue';
const tab = ref(0);
const tabbarList = [
  { icon: 'home', title: '首页' },
  { icon: 'photo', title: '放映厅' },
  { icon: 'play-right', title: '直播' },
  { icon: 'account', title: '我的' }
];
</script>

属性说明

| 属性名 | 说明 | 类型 | 默认值 | |---------------------|------------------------------|---------------------|-------------| | value | 当前选中项的索引或 name | String/Number | 0 | | items | tabbar 配置项数组 | Array | [] | | safeAreaInsetBottom | 是否为 iPhoneX 留出安全距离 | Boolean | true | | border | 是否显示上方边框 | Boolean | true | | zIndex | 层级 z-index | String/Number | 100 | | activeColor | 选中标签颜色 | String | #ff0000 | | inactiveColor | 未选中标签颜色 | String | #7d7e80 | | fixed | 是否固定在底部 | Boolean | true | | placeholder | 固定时是否占位防塌陷 | Boolean | true | | height | tabbar 高度 | String | 100rpx | | customStyle | 外部自定义样式 | Object | {} |

items 配置项说明

| 属性名 | 说明 | 类型 | |----------|----------------|-------------------| | icon | 图标名/图片 | String | | title | 文本 | String | | badge | 角标数字 | String/Number | | dot | 是否显示圆点 | Boolean | | name | 唯一标识(可选)| String/Number |

事件说明

| 事件名 | 说明 | 回调参数 | |----------|----------------|-------------------| | change | 切换选项时触发 | index/name |

常见用法

显示徽标/圆点

<zx-tabbar :value="tab" @change="tab = $event" :items="[
  { icon: 'home', title: '首页', dot: true },
  { icon: 'photo', title: '放映厅', badge: 3 },
  { icon: 'play-right', title: '直播' },
  { icon: 'account', title: '我的' }
]" />

拦截切换

<zx-tabbar :value="tab" @change="onTabChange" :items="tabbarList" />
<script setup>
function onTabChange(index) {
  if (index === 1) {
    uni.showToast({ title: '请先登录', icon: 'none' });
    return;
  }
  tab.value = index;
}
</script>

固定底部

<zx-tabbar :value="tab" @change="tab = $event" :items="tabbarList" fixed placeholder safeAreaInsetBottom />

插槽

注意事项

  • 请确保 items 数组不为空
  • 支持多端,无需关心平台差异

参考文档