react-custom-toast
Advanced tools
Comparing version 0.1.1 to 0.1.2
{ | ||
"name": "react-custom-toast", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"main": "lib/index.umd.js", | ||
@@ -19,2 +19,6 @@ "types": "lib/index.d.ts", | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git@github.com:zhzxang/react-custom-toast.git" | ||
}, | ||
"scripts": { | ||
@@ -21,0 +25,0 @@ "dev": "webpack-dev-server --mode=development --config build/dev.js --port 3010 --open", |
# react-custom-toast | ||
基于 react 的 toast 组件。可以完全的自定义样式。并提供了内置动画与控制方法 | ||
### Feature | ||
* 添加测试 | ||
* 上线 demo 网站 | ||
* 更多的内置动画效果 | ||
### 安装 | ||
@@ -48,12 +54,14 @@ | ||
`Toast(msg: string, opt: ToastOption)` // 打开`默认` | ||
`Toast(msg: string, opt: ToastOption)` // 打开`默认`提示 | ||
`Toast.open(msg: string, opt: ToastOption)` // 打开`默认` | ||
`Toast.open(msg: string, opt: ToastOption)` // 打开无状态提示 | ||
`Toast.info(msg: string, opt: ToastOption)` // 打开`提示` | ||
`Toast.info(msg: string, opt: ToastOption)` // 打开提示 | ||
`Toast.error(msg: string, opt: ToastOption)` // 打开`错误` | ||
`Toast.info(msg: string, opt: ToastOption)` // 打开`成功`提示 | ||
`Toast.warning(msg: string, opt: ToastOption)` // 打开`警告` | ||
`Toast.error(msg: string, opt: ToastOption)` // 打开`错误`提示 | ||
`Toast.warning(msg: string, opt: ToastOption)` // 打开`警告`提示 | ||
`Toast.remove(id: ToastId)` // 移除某个toast | ||
@@ -60,0 +68,0 @@ |
@@ -20,2 +20,10 @@ import event from './event' | ||
const info = (message: string = '', option: ToastOption = defaultOption) => { | ||
event.add({ | ||
...option, | ||
message, | ||
type: 'info' | ||
}) | ||
} | ||
const error = (message: string = '', option: ToastOption = defaultOption) => { | ||
@@ -29,2 +37,10 @@ event.add({ | ||
const warning = (message: string = '', option: ToastOption = defaultOption) => { | ||
event.add({ | ||
...option, | ||
message, | ||
type: 'warning' | ||
}) | ||
} | ||
const success = (message: string = '', option: ToastOption = defaultOption) => { | ||
@@ -44,7 +60,9 @@ event.add({ | ||
open, | ||
info, | ||
success, | ||
warning, | ||
error, | ||
remove | ||
remove, | ||
}) | ||
export default toast |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
260045
788
83
3