From 8ed1ffa8cb1c32e6ac839ed598d872d32741cc0e Mon Sep 17 00:00:00 2001 From: morning-star <26325820+Sight-wcg@users.noreply.github.com> Date: Tue, 18 Jun 2024 15:15:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(dropdown):=20=E9=87=8D=E5=A4=8D=20render=20?= =?UTF-8?q?=E6=97=B6=E6=9C=AA=20reload=20(#2022)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(dropdown): 重复 render 时未 reload * update * update --- src/modules/dropdown.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/modules/dropdown.js b/src/modules/dropdown.js index fc9e9443..07831fed 100644 --- a/src/modules/dropdown.js +++ b/src/modules/dropdown.js @@ -137,8 +137,8 @@ layui.define(['jquery', 'laytpl', 'lay', 'util'], function(exports){ $.extend(options, lay.options(elem[0])); // 若重复执行 render,则视为 reload 处理 - if(!rerender && elem[0] && elem.data(MOD_INDEX)){ - var newThat = thisModule.getThis(elem.data(MOD_INDEX)); + if(!rerender && elem[0] && elem.attr(MOD_ID)){ + var newThat = thisModule.getThis(elem.attr(MOD_ID)); if(!newThat) return; return newThat.reload(options, type); @@ -151,9 +151,7 @@ layui.define(['jquery', 'laytpl', 'lay', 'util'], function(exports){ elem.attr('id') || that.index ); - if(!lay.isTopElem(elem[0])){ - elem.attr(MOD_ID, options.id); - } + elem.attr(MOD_ID, options.id); // 初始化自定义字段名 options.customName = $.extend({}, dropdown.config.customName, options.customName);