refactor: 重命名部分变量

sight 6 months ago
parent def67d7bbc
commit 40943aa6fc

@ -860,8 +860,8 @@ hr.layui-border-black{border-width: 0 0 1px;}
:root .layui-form-selected .layui-edge{margin-top: -9px\0/IE9;}
.layui-form-selectup dl{top: auto; bottom: 42px;}
.layui-select-none{margin: 5px 0; text-align: center; color: #999;}
.layui-select-panel {position: absolute; z-index: 99999999;}
.layui-select-panel dl{position: static; display: block;}
.layui-select-panel-wrap {position: absolute; z-index: 99999999;}
.layui-select-panel-wrap dl{position: relative; display: block; top:0;}
.layui-select-disabled .layui-disabled{border-color: #eee !important;}
.layui-select-disabled .layui-edge{border-top-color: #d2d2d2}

@ -382,6 +382,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){
var TITLE = 'layui-select-title';
var NONE = 'layui-select-none';
var CREATE_OPTION = 'layui-select-create-option';
var PANEL_WRAP = 'layui-select-panel-wrap'
var PANEL_ELEM_DATA = 'layui-select-panel-elem-data';
var selects = elem || elemForm.find('select');
// 各种事件
@ -410,6 +411,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){
// 展开下拉
var showDown = function(){
if(isAppendToBody){
// 如果追加面板元素后出现滚动条,触发元素宽度可能会有变化,所以先追加面板元素
reElem.appendTo('body')
.show()
.css({width: title.width() + 'px'});
@ -770,9 +772,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){
// 替代元素
var reElem = $(['<div class="'+ (isSearch ? '' : 'layui-unselect ') + CLASS
,(disabled ? ' layui-select-disabled' : '')
,(isCreatable ? ' layui-select-creatable' : '')
,(isAppendToBody ? ' layui-select-append-to-body' : '') + '"></div>'].join(''));
,(disabled ? ' layui-select-disabled' : '') + '"></div>'].join(''));
var triggerElem = $([
'<div class="'+ TITLE +'">'
@ -806,14 +806,17 @@ layui.define(['lay', 'layer', 'util'], function(exports){
// 如果已经渲染则Rerender
if(hasRender[0]){
isAppendToBody && hasRender.data(PANEL_ELEM_DATA).remove();
if(isAppendToBody){
var panelWrapElem = hasRender.data(PANEL_ELEM_DATA);
panelWrapElem && panelWrapElem.remove();
}
hasRender.remove();
}
if(isAppendToBody){
reElem.append(triggerElem);
othis.after(reElem);
var contentWrapElem = $('<div class="layui-form-select layui-select-panel"></div>').append(contentElem)
reElem.data(PANEL_ELEM_DATA, contentWrapElem) // 将面板元素对象记录在触发元素 data 中
var contentWrapElem = $('<div class="'+ CLASS + ' ' + PANEL_WRAP +'"></div>').append(contentElem);
reElem.data(PANEL_ELEM_DATA, contentWrapElem); // 将面板元素对象记录在触发元素 data 中
events.call(this, contentWrapElem, triggerElem, disabled, isSearch, isCreatable, isAppendToBody);
}else{
reElem.append(triggerElem).append(contentElem);

Loading…
Cancel
Save