1、alert告警框javascript
用法 .alert(message,title,btnvalue,callback[,type]);css
document.getElementById("noclick").addEventListener('tap', function() { mui.alert("欢迎使用Hello MUI", "Hello MUI","肯定关闭", function() { mui.alert("你刚关闭了警告框","操做提示","肯定"); }); });
2、comfirm对话框java
用法.confirm(message,title,btnvalue,callback[,type]);ui
document.getElementById("noclick").addEventListener("tap",function(){ var btnarr=["肯定","取消"]; mui.confirm("你肯定关闭对话框吗?","操做提示",btnarr,function(e){ if(e.index == 0){ mui.alert("你已关闭对话框!","操做提示","肯定"); }else{ mui.alert("你取消关闭对话框!","操做提示","肯定"); } }); });
3、提示框.net
用法.toast(message[,options]);blog
message:"string"消息框显示的文字内容;options:{JSON}提示消息的参数ip
duration:持续显示时间,默认值short(2000ms),支持整数值和string,string可选:long(3500ms),short(2000ms)get
document.getElementById("noclick").addEventListener("tap",function(){ mui.toast("欢迎体验MUI",{duration:3500,type:"div"}); });
4、prompt对话提示框input
用法:.prompt(message,placeholder,title,btnvalue,callback[,type]);string
document.getElementById("noclick").addEventListener("tap",function(){ mui.prompt("你肯定要关闭本窗口吗?","肯定","操做提示",["肯定","取消"],function(e){ if(e.index == 0){ mui.toast("你已关闭窗口"); }else{ mui.toast("你取消关闭窗口"); } }) });
若是有定制对话框样式的需求(只能修改h5模式的对话框)能够再mui.css中修改.mui-popup类下的样式
//修改弹出框默认input类型为password mui.prompt('text','deftext','title',['true','false'],null,'div') document.querySelector('.mui-popup-input input').type='password'
原文地址:https://blog.csdn.net/Ag_wenbi/article/details/73497639