Webix自定义一个可以显示Loading的板

webix.protoUI({
    name: "databoard",
    mask: null,
    defaults: {
        template: function(obj, common) {
            debugger
        },
        label: "",
        borderless: true
    },
    $renderInput: function(obj) {
        var css = "class='webixtype_" + (obj.type || "base") + "' ";
        return "<button type='button' " + (obj.popup ? "aria-haspopup='true'" : "") + css + ">" + webix.template.escape(obj.label || obj.value) + "</button>";
    },
    $init: function(config) {
        webix.html.addCss(this.$view, "webix_el_databoard");
        let mask = webix.html.create("div", { "class": "webix_mask_inside" }, "<div><span></span><span></span><span></span><span></span></div>");
        this.mask = mask;
        webix.event(mask, "click", function(e) {
            webix.html.preventEvent(e);
        });
        webix.event(mask, "dblclick", function(e) {
            webix.html.preventEvent(e);
        });
        webix.event(mask, "onselectstart", function(e) {
            webix.html.preventEvent(e);
            return false;
        });
        this._viewobj.appendChild(mask);
    },
    showMask() {
        this.mask.style.display = 'block';
    }
}, webix.ui.layout);

CSS:

.webix_el_databoard {
    position: relative;
    width: 100%;
}

.webix_el_databoard .webix_mask_inside {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-color: #000;
    filter: alpha(opacity=20);
    opacity: .2;
    z-index: 999999;
    user-select: none;
    -moz-user-select: none;
    -webkit-user-select: none;
    /** display: none; **/
    text-align: center;
    display: flex;
    align-items: center;
}

.webix_el_databoard .webix_mask_inside>div {
    margin-left: auto;
    margin-right: auto;
}

.webix_el_databoard .webix_mask_inside span {
    display: inline-block;
    width: 15px;
    height: 15px;
    margin-right: 5px;
    border-radius: 50%;
    background: white;
    animation: load 1.04s ease infinite;
    -webkit-animation: load 1.04s ease infinite;
}

@keyframes load {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

@-webkit-keyframes load {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

.webix_el_databoard .webix_mask_inside span:nth-child(1) {
    animation-delay: 0.13s;
    -webkit-animation-delay: 0.13s;
}

.webix_el_databoard .webix_mask_inside span:nth-child(2) {
    animation-delay: 0.26s;
    -webkit-animation-delay: 0.26s;
}

.webix_el_databoard .webix_mask_inside span:nth-child(3) {
    animation-delay: 0.39s;
    -webkit-animation-delay: 0.39s;
}

.webix_el_databoard .webix_mask_inside span:nth-child(4) {
    animation-delay: 0.52s;
    -webkit-animation-delay: 0.52s;
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值