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

@bams-app/message

v0.2.1

Published

message 基础组件

Readme

@bams-app/message

基于 Ant Design Vue message 封装的通用消息组件,通过类(Class)封装提供了更一致的调用体验和自定义样式支持。

特性

  • 自定义 UI:使用 index.vue 作为消息内容的渲染模板,支持更灵活的布局和样式。
  • 类封装:采用单例模式封装,维护内部状态和默认配置。
  • 兼容性:同时支持具名导出(Named Exports)和默认导出(Default Export),无缝集成到现有项目。
  • 类型支持:内置 info, success, error, warning, loading 等常用消息类型。

安装与引入

import message, { info, success } from "@bams-app/message";

API 说明

消息方法

所有消息方法都支持传入 string 或 object 配置项。

  • info(args):显示普通信息。
  • success(args):显示成功提示。
  • error(args):显示错误提示。
  • warning(args):显示警告提示。
  • loading(args):显示加载中提示。

参数说明

  • 如果 args 为 string,则直接作为消息内容显示。
  • 如果 args 为 object,支持以下属性:
    • content: 消息内容(字符串)。
    • duration: 自动关闭的延时,单位秒。设为 0 时不自动关闭(默认 3 秒)。
    • class: 自定义 CSS 类名。
    • ... 其他 Ant Design Vue message 支持的配置项。

其他方法

  • destroy():销毁所有当前显示的消息。

使用示例

1. 简单调用

import { success } from "@bams-app/message";

success("操作成功!");

2. 对象参数调用

import { info } from "@bams-app/message";

info({
  content: "这是一条会自动消失的长消息",
  duration: 10,
});

3. 使用默认导出的单例

import message from "@bams-app/message";

默认配置

组件内部预设了以下默认配置:

  • duration: 3 秒
  • top: "24px"
  • maxCount: 3 (同时最多显示的消息条数)

自定义样式

消息组件使用了自定义的样式包装器 .message-custom-wrapper,并根据消息类型自动添加类名:

  • .message-type-info
  • .message-type-success
  • .message-type-error
  • .message-type-warning

具体样式实现请参考 index.vue。