wwwroot/lis/js/LayerTip.js

(开头部分) 6KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/*
模块:提示层
作者:cls
日期:2020.11.26
说明:基于jQuery 和 bootstrap-icons@1.4.0
      1、success 和 fail 层浮现3/timeOut 秒后消失
      2、loading 浮现后,需要自己 hidden
使用:
var layerTip = new LayerTip();
layerTip.render({ type: 'loading', ins: 'show' });
layerTip.render({ type: 'loading', ins: 'hidden' });
layerTip.render({ type: 'success', ins: 'show', tip: '成功!' });
layerTip.render({ type: 'fail', ins: 'show', tip: '权限不足!' });
*/

function LayerTip(o) {
    //o = { ele: 'body', layerEle: '#i-layer-success', timeOut: 3000 };
    o = o || {};
    o.ele = o.ele || "body";
    o.timeOut = o.timeOut || 3000;
    var oParent = $(o.ele);
    if (oParent.length == 0) {
        console.error("模块LayerTip初始化:缺少宿主容器!");
        return;
    }
    if (o.layerEle != undefined) {
        var sFirst = o.layerEle.slice(0, 1);
        if (sFirst != "#") {
            console.error("模块LayerTip初始化:layerEle错误,首字符应为#");
            return;
        }
        var oLayer = $(o.layerEle);
        if (oLayer.length > 0) {
            console.error("模块LayerTip初始化:已存在与layerEle相同的元素!");
            return;
        }
    }

    this.o = o;
    this.bolInit = true; //初始化标志
}

LayerTip.prototype = {
    render: function (o) {
        //o = { type: 'success', ins: 'show', tip: '成功!' } //ins: instruction
        //入参检查
        o = o || {};
        o.type = o.type || "loading";
        o.ins = o.ins || "show";
        if (o.tip == undefined || o.tip == "") {
            switch (o.type) {
                case "success":
                    o.tip = "成功!";
                    break;
                case "fail":
                    o.tip = "失败!";
                    break;
                case "loading":
                default:
                    o.tip = "加载中……";
后面还有 119 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。