1.0.0 • Published 4 years ago

toast-react v1.0.0

Weekly downloads
3
License
ISC
Repository
github
Last release
4 years ago

toast-react

a plugin of toast for react by typescript

install

npm i toast-react

use

 import { openToast } from toast-react;
 openToast('打开toast成功')

option

msg(必填)

展示内容: 默认为"undefined"

duration

展示时间,单位ms: 默认:1500ms

position

展示位置,可选为"top","center","bottom": 默认:"center"

icon

带icon的toast,可选为"loading","warn": 默认:""

zindex

toast在页面的层级: 默认:"100"

cd

toast关闭时的回调方法: 默认:null

methods

手动打开toast的方法:

openToast('打开toast');

手动关闭toast的方法:

closeToast();

example

openToast('打开toast成功', {
    duration: 3000,
},
function() {console.log('end')});

openToast('打开toast成功', {
    duration: 3000,
    icon: "loading"
});

openToast('打开toast成功', {
    position: "bottom",
    icon: "loading",

});