From 746bd44e1610cce32236ea064b7111498f4683e3 Mon Sep 17 00:00:00 2001 From: Jack Date: Thu, 28 Jul 2022 11:35:44 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20layer.photos=20?= =?UTF-8?q?=E5=BA=95=E9=83=A8=E6=8F=90=E7=A4=BA=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/layer.js | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/src/modules/layer.js b/src/modules/layer.js index 8e59e25e..4f0cba9b 100644 --- a/src/modules/layer.js +++ b/src/modules/layer.js @@ -1280,6 +1280,8 @@ layer.photos = function(options, loop, key){ loadImage(data[start].src, function(img){ layer.close(dict.loadi); + let alt = data[start].alt||''; + //切换图片时不出现动画 if(key) options.anim = -1; @@ -1317,15 +1319,36 @@ layer.photos = function(options, loop, key){ isOutAnim: false, skin: 'layui-layer-photos' + skin('photos'), content: '
' - +''+ (data[start].alt||'') +'' + +''+ alt +'' +function(){ + let tip = '
'; + if(data.length > 1){ - return '
' - +'' - +'
'+ (data[start].alt || '') +''+ dict.imgIndex +' / '+ data.length +'
' - +'
' + tip += ''; + + if(alt===''){ + tip += '
'+ dict.imgIndex +' / '+ data.length +'
'; + } + else{ + tip += '
'+ alt +''+ dict.imgIndex +' / '+ data.length +'
'; + } + + tip += '
'; } - return ''; + else if(data.length === 1){ + if(alt===''){ + tip = ''; + } + else{ + tip += '
'+ alt +'
'; + tip += '
'; + } + } + else{ + tip = ''; + } + + return tip; }() +'', success: function(layero, index){ From 821de03d8a17a5f739ae42aa219bfdf1b0b9cc03 Mon Sep 17 00:00:00 2001 From: Jack Date: Tue, 2 Aug 2022 14:36:21 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=B8=BA=20layer.photo=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E2=80=9C=E6=9F=A5=E7=9C=8B=E5=8E=9F=E5=9B=BE=E2=80=9D?= =?UTF-8?q?=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/css/modules/layer/default/layer.css | 3 ++- src/modules/layer.js | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/css/modules/layer/default/layer.css b/src/css/modules/layer/default/layer.css index 54a6aeee..75b23654 100644 --- a/src/css/modules/layer/default/layer.css +++ b/src/css/modules/layer/default/layer.css @@ -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 { diff --git a/src/modules/layer.js b/src/modules/layer.js index 4f0cba9b..75d98993 100644 --- a/src/modules/layer.js +++ b/src/modules/layer.js @@ -1327,20 +1327,20 @@ layer.photos = function(options, loop, key){ tip += ''; if(alt===''){ - tip += '
'+ dict.imgIndex +' / '+ data.length +'
'; + tip += '
'+ dict.imgIndex +' / '+ data.length +'查看原图
'; } else{ - tip += '
'+ alt +''+ dict.imgIndex +' / '+ data.length +'
'; + tip += '
'+ alt +''+ dict.imgIndex +' / '+ data.length +'查看原图
'; } tip += ''; } else if(data.length === 1){ if(alt===''){ - tip = ''; + tip = ''; } else{ - tip += '
'+ alt +'
'; + tip += '
'+ alt +'查看原图
'; tip += ''; } } From 7735aeef7bdcc767b3d6cffbede7f04ae1b8c25d Mon Sep 17 00:00:00 2001 From: Jack Date: Tue, 2 Aug 2022 14:38:15 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=B0=86=20layer.photo=20=E7=9A=84=20let?= =?UTF-8?q?=20=E6=94=B9=E4=B8=BA=20var?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/layer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/layer.js b/src/modules/layer.js index 75d98993..ecdbbf7d 100644 --- a/src/modules/layer.js +++ b/src/modules/layer.js @@ -1280,7 +1280,7 @@ layer.photos = function(options, loop, key){ loadImage(data[start].src, function(img){ layer.close(dict.loadi); - let alt = data[start].alt||''; + var alt = data[start].alt||''; //切换图片时不出现动画 if(key) options.anim = -1; @@ -1321,7 +1321,7 @@ layer.photos = function(options, loop, key){ content: '
' +''+ alt +'' +function(){ - let tip = '
'; + var tip = '
'; if(data.length > 1){ tip += '';