令人愉悦且高度可定制的 React 组件,可通知您的用户
SASS 文件位于 React-notifications-component/dist/scss
在应用程序的顶部渲染 React-notifications-component,以免与其他绝对定位的 DOM 元素发生冲突。
const App = () => {
return (
)
};根据需要导入 Store - 将用于访问 addNotification 和 removeNotification API 方法
import { Store } from 'react-notifications-component';然后调用 addNotification 并观察魔术的发生
Store.addNotification({
title: "Wonderful!",
message: "teodosii@react-notifications-component",
type: "success",
insert: "top",
container: "top-right",
animationIn: ["animate__animated", "animate__fadeIn"],
animationOut: ["animate__animated", "animate__fadeOut"],
dismiss: {
duration: 5000,
onScreen: true
}
});Voila!
注意: 在此示例中,我们依赖 animate.css,因为 animate__fadeIn 和 animate__fadeOut 都是 animate.css 的一部分。我们建议使用它,因为它是一个优秀的动画库,但你并非必须使用它。如果你更喜欢,也可以使用自定义的动画,只要它们符合 vali
暂无开放 Issues,或尚未同步最近议题。