layer.confirm( 找不到 on函数

        function systc() {

            var t = layer.confirm('确认要退出系统吗?', {
                btn: ['确定', '取消'] //按钮
            }, function () {

                $("#btnDel").click();



            }, function () {
   
            });

            document.getElementById('layui-layer' + t).addEventListener("click", event);
            function event(e) {
                var that = e.target;
                switch (that.nodeName.toLowerCase()) {
                    case 'a':
                        //检测 类是否存在 ;
                        if (that.innerText == "确定" || that.innerText == "取消" ) {

                            var dm = document.getElementById('layui-layer' + t);
                            dm.parentNode.removeChild(dm);

                            var shade = document.getElementById('layui-layer-shade' + t);
                            shade.parentNode.removeChild(shade);
                            if (that.innerText == "确定") {
                                $("#btnDel").click();
                            }
                        }
                        if (that.className.indexOf("layui-layer-close") != -1) {

                            var dm = document.getElementById('layui-layer' + t);
                            dm.parentNode.removeChild(dm);

                            var shade = document.getElementById('layui-layer-shade' + t);
                            shade.parentNode.removeChild(shade);


                        }


                        break;

                }

                e.cancelBubble = true;
                e.stopPropagation();
            }
        }

 

posted @ 2020-05-29 08:54  enych  阅读(338)  评论(0编辑  收藏  举报