mirror of https://github.com/layui/layui
优化 dropdown 初始化方法相关代码
parent
461ae352b8
commit
9c6a0a8182
|
@ -91,9 +91,9 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
|
||||||
|
|
||||||
// 初始化准备
|
// 初始化准备
|
||||||
Class.prototype.init = function(rerender){
|
Class.prototype.init = function(rerender){
|
||||||
var that = this
|
var that = this;
|
||||||
,options = that.config
|
var options = that.config;
|
||||||
,elem = options.elem = $(options.elem);
|
var elem = options.elem = $(options.elem);
|
||||||
|
|
||||||
// 若 elem 非唯一
|
// 若 elem 非唯一
|
||||||
if(elem.length > 1){
|
if(elem.length > 1){
|
||||||
|
@ -115,7 +115,7 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
|
||||||
|
|
||||||
// 初始化 id 属性 - 优先取 options > 元素 id > 自增索引
|
// 初始化 id 属性 - 优先取 options > 元素 id > 自增索引
|
||||||
options.id = 'id' in options ? options.id : (
|
options.id = 'id' in options ? options.id : (
|
||||||
options.elem.attr('id') || that.index
|
elem.attr('id') || that.index
|
||||||
);
|
);
|
||||||
|
|
||||||
if(options.show) that.render(rerender); // 初始即显示
|
if(options.show) that.render(rerender); // 初始即显示
|
||||||
|
|
Loading…
Reference in New Issue