diff --git a/src/modules/dropdown.js b/src/modules/dropdown.js index 7587f0e1..685b8a04 100644 --- a/src/modules/dropdown.js +++ b/src/modules/dropdown.js @@ -48,6 +48,9 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){ ,reload: function(options){ that.reload.call(that, options); } + ,remove: function () { + that.remove() + } } } diff --git a/src/modules/laydate.js b/src/modules/laydate.js index 2b110822..fdf6f9ca 100644 --- a/src/modules/laydate.js +++ b/src/modules/laydate.js @@ -105,7 +105,7 @@ var elem = lay(options.elem || that.config.elem); if(elem.length > 1){ lay.each(elem, function(){ - laydate.render(lay.extend({}, that.config, lay.options(this),{ + laydate.render(lay.extend({}, that.config, { elem: this })); }); @@ -113,7 +113,7 @@ } // 初始化 id 参数 - options = that.config; + options = lay.extend(that.config, lay.options(elem[0])); // 继承节点上的属性 options.id = ('id' in options) ? options.id : that.index; // 初始化 @@ -162,6 +162,7 @@ ,zIndex: null //控件层叠顺序 ,done: null //控件选择完毕后的回调,点击清空/现在/确定也均会触发 ,change: null //日期时间改变后的回调 + ,autoConfirm: true //是否自动确认(日期|年份|月份选择器非range下是否自动确认) }; //多语言 @@ -579,7 +580,7 @@ lay(this).addClass(THIS); - if (options.position !== 'static' && !options.range) { + if (options.position !== 'static' && !options.range && options.autoConfirm) { if (type === 'date') { that.choose(lay(elem).find('td.layui-this')) } else if (type === 'year' || type === 'month') { @@ -1352,7 +1353,7 @@ //若为月选择器,只有当选择月份时才自动关闭; //若为年选择器,选择年份即自动关闭 //且在范围未开启时 - if(!options.range){ + if(!options.range && options.autoConfirm){ if((options.type === 'month' && type === 'month') || (options.type === 'year' && type === 'year')){ that.setValue(that.parse()).remove().done(); } @@ -1640,7 +1641,7 @@ } else if(options.position === 'static'){ //直接嵌套的选中 that.calendar().done().done(null, 'change'); //同时执行 done 和 change 回调 } else if(options.type === 'date'){ - that.setValue(that.parse()).remove().done(); + options.autoConfirm ? that.setValue(that.parse()).remove().done() : that.calendar().done(null, 'change'); } else if(options.type === 'datetime'){ that.calendar().done(null, 'change'); } diff --git a/src/modules/table.js b/src/modules/table.js index dfcdb3f2..f01df71b 100644 --- a/src/modules/table.js +++ b/src/modules/table.js @@ -309,6 +309,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){ ,text: { none: '无数据' } + ,cols: [] }; // 表格渲染 @@ -2331,7 +2332,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){ var tableIns = table.render(options); //获取表体数据 - if (trElem.length && !tableIns.config.url) { + if (trElem.length && !settings.data && !tableIns.config.url) { var tdIndex = 0; table.eachCols(tableIns.config.id, function (i3, item3) { trElem.each(function(i1){