From c20b6b479814b5aff9621ce500aee59a548b63b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Mon, 27 Mar 2023 12:25:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=20`layui.unbind()`=20?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E5=90=8D=E4=B8=BA=20`laydate.unbind()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/laydate.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/modules/laydate.js b/src/modules/laydate.js index ec986a68..07b6d36d 100644 --- a/src/modules/laydate.js +++ b/src/modules/laydate.js @@ -2099,16 +2099,17 @@ options.elem[0].eventHandler = true; options.eventElem.on(options.trigger, showEvent); - that.destroy = function () { + // 元素解绑 + that.unbind = function () { that.remove(); options.elem.off(options.trigger, showEvent); options.elem.removeAttr('lay-key'); + options.elem.removeAttr(MOD_ID); options.elem[0].eventHandler = false; options.eventElem.off(options.trigger, showEvent); options.eventElem.removeAttr('lay-key'); - delete thisModule.that[options.id]; - } + }; }; //记录所有实例 @@ -2232,6 +2233,13 @@ return new Date(thisDate.getTime() - 1000*60*60*24).getDate(); }; + // 解绑实例 + laydate.unbind = function(id){ + var that = thisModule.getThis(id || laydate.thisId); + if(!that) return; + return that.unbind(); + }; + // 关闭日期面板 laydate.close = function(id){ var that = thisModule.getThis(id || laydate.thisId); @@ -2239,12 +2247,7 @@ return that.remove(); }; - // 销毁实例 - laydate.destroy = function(id){ - var that = thisModule.getThis(id || laydate.thisId); - if(!that) return; - return that.destroy(); - }; + //加载方式 isLayui ? (