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){