JS组件-aui-toast

aui-toast.js为弹出提示类的组件

使用方法:

var toast = new auiToast();

成功类:

toast.success({
    title:"提交成功",
    duration:2000
});

失败类:
toast.fail({
    title:"提交失败",
    duration:2000
});

自定义图标:
toast.custom({
    title:"成功给了一个赞",
    html:'<i class="aui-iconfont aui-icon-laud"></i>',
    duration:2000
});

加载中:
toast.loading({
    title:"加载中",
    duration:2000
},function(ret){
    console.log(ret);
    setTimeout(function(){
        toast.hide();
    }, 3000)
});

<div class="aui-btn aui-btn-block aui-btn-info" tapmode onclick="showDefault('success')">默认样式(toast)</div>
<div class="aui-btn aui-btn-block aui-btn-success" tapmode onclick="showDefault('fail')">失败(toast)</div>
<div class="aui-btn aui-btn-block aui-btn-success" tapmode onclick="showDefault('custom')">自定义</div>
<div class="aui-btn aui-btn-block aui-btn-warning" tapmode onclick="showDefault('loading')">弹出loading样式(toast)</div>
<script type="text/javascript" src="../../script/2.0/aui-toast.js" ></script>
<script type="text/javascript">
    apiready = function(){
        api.parseTapmode();
    }
    var toast = new auiToast();
    function showDefault(type){
        switch (type) {
            case "success":
                toast.success({
                    title:"提交成功",
                    duration:2000
                });
                break;
            case "fail":
                toast.fail({
                    title:"提交失败",
                    duration:2000
                });
                break;
            case "custom":
                toast.custom({
                    title:"提交成功",
                    html:'<i class="aui-iconfont aui-icon-laud"></i>',
                    duration:2000
                });
                break;
            case "loading":
                toast.loading({
                    title:"加载中",
                    duration:2000
                },function(ret){
                    console.log(ret);
                    setTimeout(function(){
                        toast.hide();
                    }, 3000)
                });
                break;
            default:
                // statements_def
                break;
        }
    }

</script>