zoukankan      html  css  js  c++  java
  • showPrompt弹框提示

    工作中会有很多的弹框,用来添加模板,用来信息提示,,我现在用的模板有dialog(用来添加数据模板内容),还有一个就是自写的showPrompt用来判断错误或者正确的信息~~

    样子大概就是这样的,, 其中有几种调用状态,成功/失败/异常等~ 

    首先写一个提示的函数方法

    function showPrompt(html, type, callback) {
        var type = type || 'common';
    
        var typeClass = '';
    
    
        if (type == 'common') {
            typeIcon = 'icon-tishi';
        } else if (type == 'success') {
            typeIcon = 'icon-chenggong';
        } else if (type == 'error') {
            typeIcon = 'icon-shanchu';
        } else if (type == 'warn') {
            typeIcon = 'icon-jinggao';
        }
    
        var typeIconHtml = '<i class="icon-tip iconfont ' + typeIcon + '" style="margin-right:10px;font-size:30px;vertical-align: sub;"></i>';
    
    
        var d = dialog({
            content: '<div style="min-124px;max-800px;text-align:center;font-size:16px;padding: 10px 30px;">' + typeIconHtml + html + '</div>',
            skin: 'prompt-dialog-' + type,
            quickClose: true,
            onclose: function() {
                callback && callback();
            }
        }).show();
    
        setTimeout(function() {
            d.open && d.close().remove();
        }, 2000);
    }

    代码很少,因为功能教简单, 然后就是调用的时候~可以这样调用~

    showPrompt('提示消息','success', function() {   //success成功提示
       //回调的操作
    })
    
    showPrompt('提示消息','error'); //错误提示

    很简单,也很方便~~

  • 相关阅读:
    LeetCode90.子集 ||
    Ubuntu下的Matlab安装
    FAQ
    青石板
    交叉熵损失函数
    tf常用函数
    激活函数
    SGD和GD的区别
    卷积神经网络
    Ubuntu安装Matlab2016b
  • 原文地址:https://www.cnblogs.com/htzan/p/6186108.html
Copyright © 2011-2022 走看看