form修复当前下拉选中的index不在当前option的范围的时候默认选中了最后一个节点的问题

pull/1172/head
sunxiaobin89 2022-12-03 19:27:29 +08:00
parent eff6fffdd0
commit 0a4bb74c57
1 changed files with 2 additions and 2 deletions

View File

@ -259,14 +259,14 @@ layui.define(['layer', 'util'], function(exports){
,dlHeight = dl.outerHeight(); ,dlHeight = dl.outerHeight();
index = select[0].selectedIndex; // 获取最新的 selectedIndex index = select[0].selectedIndex; // 获取最新的 selectedIndex
index === -1 && (index = 0);
reElem.addClass(CLASS+'ed'); reElem.addClass(CLASS+'ed');
dds.removeClass(HIDE); dds.removeClass(HIDE);
dts.removeClass(HIDE); dts.removeClass(HIDE);
nearElem = null; nearElem = null;
// 初始选中样式 // 初始选中样式
dds.eq(index).addClass(THIS).siblings().removeClass(THIS); dds.removeClass(THIS);
index >= 0 && dds.eq(index).addClass(THIS);
// 上下定位识别 // 上下定位识别
if(top + dlHeight > $win.height() && top >= dlHeight){ if(top + dlHeight > $win.height() && top >= dlHeight){