toastr是非阻塞通知的JavaScript库
layui.use(["okToastr"], function () {
// 引入okToastr
let okToastr = layui.okToastr;
// 是否显示关闭按钮
okToastr.options.closeButton = true;
// 回调函数
okToastr.options.onShown = function () {
console.log("hello");
}
okToastr.options.onHidden = function () {
console.log("goodbye");
}
okToastr.options.onclick = function () {
console.log("clicked");
}
okToastr.options.onCloseClick = function () {
console.log("close button clicked");
}
// info
okToastr.info("ok-admin");
// success
okToastr.success("ok-admin");
// warning
okToastr.warning("ok-admin");
// error
okToastr.error("ok-admin");
// remove
okToastr.remove();
// clear
okToastr.clear();
});