Merge branch '2.x' of github.com:layui/layui into 2.x

pull/1120/head
贤心 2022-08-19 00:53:55 +08:00
commit c8c4fc00fe
4 changed files with 42 additions and 9 deletions

View File

@ -157,7 +157,8 @@ html #layuicss-layer{display: none; position: absolute; width: 1989px;}
.layui-layer-imgtit *{display:inline-block; *display:inline; *zoom:1; vertical-align:top; font-size:12px;} .layui-layer-imgtit *{display:inline-block; *display:inline; *zoom:1; vertical-align:top; font-size:12px;}
.layui-layer-imgtit a{max-width:65%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; color:#fff;} .layui-layer-imgtit a{max-width:65%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; color:#fff;}
.layui-layer-imgtit a:hover{color:#fff; text-decoration:underline;} .layui-layer-imgtit a:hover{color:#fff; text-decoration:underline;}
.layui-layer-imgtit em{padding-left:10px; font-style: normal;} .layui-layer-imgtit em{padding:0 10px; font-style: normal;}
.layui-layer-imgtit>span+a{margin-left: 10px;}
/* 关闭动画 */ /* 关闭动画 */
@-webkit-keyframes layer-bounceOut { @-webkit-keyframes layer-bounceOut {

View File

@ -1412,6 +1412,8 @@ layer.photos = function(options, loop, key){
loadImage(data[start].src, function(img){ loadImage(data[start].src, function(img){
layer.close(dict.loadi); layer.close(dict.loadi);
var alt = data[start].alt||'';
//切换图片时不出现动画 //切换图片时不出现动画
if(key) options.anim = -1; if(key) options.anim = -1;
@ -1449,15 +1451,36 @@ layer.photos = function(options, loop, key){
isOutAnim: false, isOutAnim: false,
skin: 'layui-layer-photos' + skin('photos'), skin: 'layui-layer-photos' + skin('photos'),
content: '<div class="layui-layer-phimg">' content: '<div class="layui-layer-phimg">'
+'<img src="'+ data[start].src +'" alt="'+ (data[start].alt||'') +'" layer-pid="'+ data[start].pid +'">' +'<img src="'+ data[start].src +'" alt="'+ alt +'" layer-pid="'+ data[start].pid +'">'
+function(){ +function(){
var tip = '<div class="layui-layer-imgsee">';
if(data.length > 1){ if(data.length > 1){
return '<div class="layui-layer-imgsee">' tip += '<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>';
+'<div class="layui-layer-imguide"><span class="layui-icon layui-icon-left layui-layer-iconext layui-layer-imgprev"></span><span class="layui-icon layui-icon-right layui-layer-iconext layui-layer-imgnext"></span></div>'
+'<div class="layui-layer-imgbar" style="display:'+ (key ? 'block' : '') +'"><span class="layui-layer-imgtit"><a href="javascript:;">'+ (data[start].alt || '') +'</a><em>'+ dict.imgIndex +' / '+ data.length +'</em></span></div>' if(alt===''){
+'</div>' tip += '<div class="layui-layer-imgbar" style="display:'+ (key ? 'block' : '') +'"><span class="layui-layer-imgtit"><em>'+ dict.imgIndex +' / '+ data.length +'</em><a href="'+data[start].src+'" target="_blank">查看原图</a></span></div>';
} }
return ''; else{
tip += '<div class="layui-layer-imgbar" style="display:'+ (key ? 'block' : '') +'"><span class="layui-layer-imgtit"><span>'+ alt +'</span><em>'+ dict.imgIndex +' / '+ data.length +'</em><a href="'+data[start].src+'" target="_blank">查看原图</a></span></div>';
}
tip += '</div>';
}
else if(data.length === 1){
if(alt===''){
tip = '<div class="layui-layer-imgbar" style="display:'+ (key ? 'block' : '') +'"><span class="layui-layer-imgtit"><a href="'+data[start].src+'" target="_blank">查看原图</a></span></div>';
}
else{
tip += '<div class="layui-layer-imgbar" style="display:'+ (key ? 'block' : '') +'"><span class="layui-layer-imgtit"><span>'+ alt +'</span><a href="'+data[start].src+'" target="_blank">查看原图</a></span></div>';
tip += '</div>';
}
}
else{
tip = '';
}
return tip;
}() }()
+'</div>', +'</div>',
success: function(layero, index){ success: function(layero, index){

View File

@ -347,6 +347,11 @@ layui.define(['laytpl', 'laypage', 'form', 'util'], function(exports){
if(options.height && /^full-\d+$/.test(options.height)){ if(options.height && /^full-\d+$/.test(options.height)){
that.fullHeightGap = options.height.split('-')[1]; that.fullHeightGap = options.height.split('-')[1];
options.height = _WIN.height() - that.fullHeightGap; options.height = _WIN.height() - that.fullHeightGap;
} else if (options.height && /^#\w+-{1}\d+$/.test(options.height)) {
var parentDiv = options.height.split("-");
that.parentHeightGap = parentDiv.pop();
that.parentDiv = parentDiv.join("-");
options.height = $(that.parentDiv).height() - that.parentHeightGap;
} }
//初始化一些参数 //初始化一些参数
@ -1487,6 +1492,10 @@ layui.define(['laytpl', 'laypage', 'form', 'util'], function(exports){
height = _WIN.height() - that.fullHeightGap; height = _WIN.height() - that.fullHeightGap;
if(height < 135) height = 135; if(height < 135) height = 135;
that.elem.css('height', height); that.elem.css('height', height);
} else if (that.parentDiv && that.parentHeightGap) {
height = $(that.parentDiv).height() - that.parentHeightGap;
if (height < 135) height = 135;
that.elem.css("height", height);
} }
if(!height) return; if(!height) return;

View File

@ -760,7 +760,7 @@ layui.define('form', function(exports){
//若返回数字 //若返回数字
if(typeof checkedId === 'number'){ if(typeof checkedId === 'number'){
if(thisId == checkedId){ if(thisId.toString() == checkedId.toString()){
if(!input[0].checked){ if(!input[0].checked){
reInput.click(); reInput.click();
}; };
@ -770,7 +770,7 @@ layui.define('form', function(exports){
//若返回数组 //若返回数组
else if(typeof checkedId === 'object'){ else if(typeof checkedId === 'object'){
layui.each(checkedId, function(index, value){ layui.each(checkedId, function(index, value){
if(value == thisId && !input[0].checked){ if(value.toString() == thisId.toString() && !input[0].checked){
reInput.click(); reInput.click();
return true; return true;
} }