Merge pull request #1119 from layui/main

同步主干最新修改到 2.x 分支
This commit is contained in:
贤心 2022-08-19 00:49:19 +08:00 committed by GitHub
commit 7ff7a27504
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 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 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 {

View File

@ -1412,6 +1412,8 @@ layer.photos = function(options, loop, key){
loadImage(data[start].src, function(img){
layer.close(dict.loadi);
var alt = data[start].alt||'';
//切换图片时不出现动画
if(key) options.anim = -1;
@ -1449,15 +1451,36 @@ layer.photos = function(options, loop, key){
isOutAnim: false,
skin: 'layui-layer-photos' + skin('photos'),
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(){
var tip = '<div class="layui-layer-imgsee">';
if(data.length > 1){
return '<div class="layui-layer-imgsee">'
+'<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>'
+'</div>'
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>';
if(alt===''){
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>';
}
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>';
}
return '';
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>',
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)){
that.fullHeightGap = options.height.split('-')[1];
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;
if(height < 135) height = 135;
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;

View File

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