pull/1090/head
贤心 2022-07-18 00:01:27 +08:00
parent 37bc2311ca
commit 397cf80f7c
2 changed files with 22 additions and 4 deletions

View File

@ -257,13 +257,19 @@ layui.use('laydate', function(laydate){
} }
}); });
//同时绑定多个 // 同时绑定多个
laydate.render({
elem: '.test-item',
trigger: 'click'
});
/*
lay('.test-item').each(function(){ lay('.test-item').each(function(){
laydate.render({ laydate.render({
elem: this elem: this
,trigger: 'click' ,trigger: 'click'
}); });
}); });
*/
//自定义重要日 //自定义重要日
var ins555 = laydate.render({ var ins555 = laydate.render({

View File

@ -74,6 +74,17 @@
var that = this; var that = this;
that.index = ++laydate.index; that.index = ++laydate.index;
that.config = lay.extend({}, that.config, laydate.config, options); that.config = lay.extend({}, that.config, laydate.config, options);
// 若 elem 非唯一,则拆分为多个实例
var elem = lay(options.elem || that.config.elem);
if(elem.length > 1){
layui.each(elem, function(){
laydate.render(lay.extend({}, that.config, {
elem: this
}));
});
return that;
}
//初始化 id 参数 //初始化 id 参数
options = that.config; options = that.config;
@ -1292,7 +1303,7 @@
); );
}; };
//获得指定日期时间对象时间戳 // 获得指定日期时间对象的毫秒数
Class.prototype.getDateTime = function(obj){ Class.prototype.getDateTime = function(obj){
return this.newDate(obj).getTime(); return this.newDate(obj).getTime();
} }
@ -1773,8 +1784,9 @@
// 关闭日期面板 // 关闭日期面板
laydate.close = function(id){ laydate.close = function(id){
var elem = lay('#'+ (id ? ('layui-laydate'+ id) : Class.thisElemDate)); var that = thisModule.getThis(id || laydate.thisId);
elem.remove(); if(!that) return;
return that.remove();
}; };
//加载方式 //加载方式