From 7c5a558e26c2b70e8d7f6a4a9fe88c412b24d677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Sun, 26 Mar 2023 15:11:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20laydate=20=E7=9A=84=20`id`?= =?UTF-8?q?=20=E5=B1=9E=E6=80=A7=E5=8F=96=E5=80=BC=E4=BC=98=E5=85=88?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/laydate.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/laydate.js b/src/modules/laydate.js index 3b83ab0a..8a05e714 100644 --- a/src/modules/laydate.js +++ b/src/modules/laydate.js @@ -116,7 +116,9 @@ // 初始化 id 参数 options = lay.extend(that.config, lay.options(elem[0])); // 继承节点上的属性 - options.id = ('id' in options) ? options.id : that.index; + options.id = 'id' in options ? options.id : ( + elem.attr('id') || that.index + ); // 初始化 laydate.ready(function(){