MUI - Dialog 提示窗

Mui基本简介

MUI不依赖任何第三方JS库,压缩后的JS和CSS文件仅有100+K和60+K

MUI的开发手册和下载地址

http://dev.dcloud.net.cn/mui/ui/

https://github.com/dcloudio/mui

建议加入该样式:

.mui-popup{position: fixed;}

Dialog 提示窗

效果类似 alert 、 confirm 、 prompt 、 Msg,样式与IOS高度相似

//提示警告框alert
document.getElementById("alertBtn").addEventListener('tap', function()
{    
    mui.alert('欢迎使用Hello MUI', 'Hello MUI', function() 
    {
        info.innerText = '你刚关闭了警告框';
    });
});


//确认框confirm
document.getElementById("confirmBtn").addEventListener('tap', function() 
{
    var btnArray = ['否', '是'];
    mui.confirm('MUI是个好框架,确认?', 'Hello MUI', btnArray, function(e) 
    {
        if (e.index == 1) 
        {
            info.innerText = '你刚确认MUI是个好框架';
        } 
        else 
        {
            info.innerText = 'MUI没有得到你的认可,继续加油'
        }
    })
});


//输入框prompt
document.getElementById("promptBtn").addEventListener('tap', function(e) 
{
    //修复iOS 8.x平台存在的bug,使用plus.nativeUI.prompt会造成输入法闪一下又没了
    e.detail.gesture.preventDefault(); 
    var btnArray = ['取消', '确定'];
    mui.prompt('请输入你对MUI的评语:', '性能好', 'Hello MUI', btnArray, function(e) 
    {
        if (e.index == 1) 
        {
            info.innerText = '谢谢你的评语:' + e.value;
        } 
        else 
        {
            info.innerText = '你点了取消按钮';
        }
    })
});


//消息框Msg
document.getElementById("toastBtn").addEventListener('tap', function() 
{
    mui.toast('欢迎体验Hello MUI');
});
发布了44 篇原创文章 · 获赞 11 · 访问量 49万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章