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

v1.0.5

Published

提示组件

Readme

zx-toast 组件

介绍

zx-toast 是一个基于 uni-app 的跨端(H5/小程序/APP)消息提示组件,支持多种主题、位置、遮罩、加载、手动/自动关闭等功能,无需依赖浏览器特有 DOM。

基本用法

<template>
  <zx-toast ref="toast" />
  <button @click="showToast">显示Toast</button>
</template>

<script setup>
import { ref } from 'vue';
const toast = ref(null);
function showToast() {
  toast.value.show({ message: '操作成功', type: 'success' });
}
</script>

属性说明

| 属性名 | 类型 | 默认值 | 说明 | | ----------- | --------------- | ---------- | ---------------------------- | | type | String | default | 主题类型:success、error、warning、primary、default、loading | | zIndex | String/Number | 10090 | 层级 | | loading | Boolean | false | 是否加载中 | | message | String/Number | '' | 显示的文字内容 | | icon | String | '' | 图标名或图片路径 | | overlay | Boolean | false | 是否显示遮罩 | | position | String | center | 位置:top、center、bottom | | params | Object | {} | 跳转参数 | | duration | String/Number | 2000 | 展示时间(ms),0为手动关闭 | | isTab | Boolean | false | 跳转是否为tab页面 | | url | String | '' | toast消失后跳转页面 | | back | Boolean | false | toast结束后返回上一页 | | customStyle | Object | {} | 内容自定义样式 | | show | Boolean | false | 是否显示(受控) |

方法

show(options)

显示toast。options为对象,支持上述所有属性。

hide()

隐藏toast。

事件

无(如需进入页面即显示toast,请在onReady生命周期调用show)。

示例

详见 src/pages/components/toast/index.vue

  • 普通提示
  • 成功/失败/警告/主要类型
  • 加载中(手动关闭)
  • 顶部/底部/居中显示
  • 带遮罩
  • 自定义图标
  • 手动关闭

跨端兼容说明

  • 组件不依赖window、document等浏览器特有对象。
  • 使用 <view><text> 等通用标签,样式兼容H5、小程序、APP。
  • 跳转、返回等操作使用 uni.navigateTouni.navigateBack

依赖

  • 依赖 zx-overlayzx-iconzx-loading-iconzx-gap 组件,请确保已注册。

联系与反馈

如有问题或建议,请提交 issue。