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 🙏

© 2024 – Pkg Stats / Ryan Hefner

rat-message

v0.1.28

Published

rat-message component for Rat.

Downloads

7

Readme

rat-message

  • category: Components
  • chinese: 信息提示
  • type: 展示

开发指南

API

Message

| 参数 | 说明 | 类型 | 默认值 | | -------------- | ---------------------------------------------------------------------------------- | --------- | --------- | | size | 反馈大小可选值:'medium', 'large' | Enum | 'medium' | | type | 反馈类型可选值:'success', 'warning', 'error', 'notice', 'help', 'loading' | Enum | 'success' | | shape | 反馈外观可选值:'inline', 'addon', 'toast' | Enum | 'inline' | | title | 标题 | ReactNode | - | | children | 内容 | ReactNode | - | | defaultVisible | 默认是否显示 | Boolean | true | | visible | 当前是否显示 | Boolean | - | | iconType | 显示的图标类型,会覆盖内部设置的IconType | String | - | | closeable | 显示关闭按钮 | Boolean | false | | onClose | 关闭按钮的回调签名:Function() => void | Function | () => {} | | afterClose | 关闭之后调用的函数签名:Function() => void | Function | () => {} |

Message.show

Message.show(props) 提供一个单例的调用方式,配置参数如下(继承 Overlay 的配置):

| 参数 | 说明 | 类型 | 默认值 | | ------------ | --------------------- | --------- | --------- | | type | 反馈类型 | String | 'success' | | title | 反馈标题 | ReactNode | - | | content | 反馈内容 | ReactNode | - | | duration | 显示持续时间,0表示一直存在,以毫秒为单位 | Number | 3000 | | align | 对齐方式,参考Overlay | String | 'tc tc' | | offset | 对齐之后的偏移位置 | Array | [0, 0] | | hasMask | 是否带有遮罩 | Boolean | false | | closeable | 显示关闭按钮 | Boolean | false | | afterClose | 关闭事件的回调函数 | Function | - | | overlayProps | 透传到弹层的属性对象 | Object | - |

示例:

Message.show({
    type: 'error',
    title: '错误',
    content: '请联系相关人员反馈!',
    hasMask: true
});

Message.hide

Message.hide() 提供关闭反馈弹层的快捷方法。

Message.[success|error|notice|help|loading]

Message.show({type: type, title: 'xxx'}); 的便捷调用方法。

示例:

Message.success('反馈内容');

// 或者
Message.success({
    title: '反馈内容',
    duration: 1000
});