Merge pull request #1090 from layui/2.x

新增和修复若干项
pull/1101/head
贤心 2022-07-18 00:08:09 +08:00 committed by GitHub
commit 7ec1cb7430
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 34 additions and 8 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

@ -16,6 +16,8 @@ body{padding:100px 0;}
<div class="layui-container"> <div class="layui-container">
<div id="slideTest1"></div> <div id="slideTest1"></div>
<br>
<div id="slideTest2" style="margin: 45px 30px; display: inline-block;"></div>
</div> </div>
<script src="../src/layui.js"></script> <script src="../src/layui.js"></script>
@ -50,6 +52,12 @@ layui.use('slider', function(){
}); });
sliderInst.setValue(30); sliderInst.setValue(30);
slider.render({
elem: '#slideTest2',
type: 'vertical'
});
}); });
</script> </script>
</body> </body>

View File

@ -495,7 +495,7 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
//是否超出底部屏幕 //是否超出底部屏幕
if(rect.bottom > _WIN.height()){ if(rect.bottom > _WIN.height()){
elemPanel.eq(0).css('margin-top', -(rect.bottom - _WIN.height())); elemPanel.eq(0).css('margin-top', -(rect.bottom - _WIN.height() + 5));
}; };
}).on('mouseleave', ELEM_LI_PAR, function(e){ }).on('mouseleave', ELEM_LI_PAR, function(e){
var othis = $(this) var othis = $(this)

View File

@ -131,9 +131,9 @@ layui.define('jquery', function(exports){
,filter = parents.attr('lay-filter'); ,filter = parents.attr('lay-filter');
if(li.hasClass(THIS)){ if(li.hasClass(THIS)){
if (li.next()[0] && li.next()[0].tagName === 'LI'){ if (li.next()[0] && li.next().is('li')){
call.tabClick.call(li.next()[0], null, index + 1); call.tabClick.call(li.next()[0], null, index + 1);
} else if (li.prev()[0] && li.prev()[0].tagName === 'LI'){ } else if (li.prev()[0] && li.prev().is('li')){
call.tabClick.call(li.prev()[0], null, index - 1); call.tabClick.call(li.prev()[0], null, index - 1);
} }
} }

View File

@ -75,6 +75,17 @@
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;
options.id = ('id' in options) ? options.id : that.index; options.id = ('id' in options) ? options.id : that.index;
@ -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();
}; };
//加载方式 //加载方式

View File

@ -850,7 +850,7 @@ layer.style = function(index, options, limit){
} }
layero.css(options); layero.css(options);
btnHeight = layero.find('.'+doms[6]).outerHeight(); btnHeight = layero.find('.'+doms[6]).outerHeight() || 0;
if(type === ready.type[2]){ if(type === ready.type[2]){
layero.find('iframe').css({ layero.find('iframe').css({