开发环境
toast 用于 消息通知 场景

显示代码

									
								
消息提醒
toast.success({title:"成功消息",message:"消息描述"})

toast.error({title:"危险消息",message:"消息描述"})

toast.warning({title:"警告消息",message:"消息描述"})

toast.info({title:"通知消息",message:"消息描述"})

显示代码

									layui.use(['toast', 'jquery', 'layer', 'code'], function() {
									    var toast = layui.toast;
										                         
									    toast.success({title: 'Caution',message: 'You forgot important data',position: 'topRight'});
									    
										toast.info({title: 'Caution',message: 'You forgot important data',position: 'topRight'});
									    
										toast.warning({title: 'Caution',message: 'You forgot important data',position: 'topRight'});
									    
										toast.error({title: 'Caution',message: 'You forgot important data',position: 'topRight'});
									    
										toast.question({title: 'Caution',message: 'You forgot important data',position: 'topRight'});
									})
								
不同位置

显示代码

									layui.use(['toast', 'jquery', 'layer', 'code'], function() {
									    var toast = layui.toast;
										                         
									    $(".toast-top-left-btn").click(function(){
									        toast.success({title: 'Caution',message: 'You forgot important data',position: 'topLeft'});
									    })
									    $(".toast-top-center-btn").click(function(){
									        toast.success({title: 'Caution',message: 'You forgot important data',position: 'topCenter'});
									    })
									    $(".toast-top-right-btn").click(function(){
									        toast.success({title: 'Caution',message: 'You forgot important data',position: 'topRight'});
									    })
									    $(".toast-bottom-left-btn").click(function(){
									        toast.success({title: 'Caution',message: 'You forgot important data',position: 'bottomLeft'});
									    })
									    $(".toast-bottom-center-btn").click(function(){
									        toast.success({title: 'Caution',message: 'You forgot important data',position: 'bottomCenter'});
									    })
									    $(".toast-bottom-right-btn").click(function(){
									        toast.success({title: 'Caution',message: 'You forgot important data',position: 'bottomRight'});
									    })
									})
								
消息移除

显示代码

									layui.use(['toast', 'jquery', 'layer', 'code'], function() {
									    var toast = layui.toast;
										                         
									    toast.destroy();
									})