Pre Merge pull request !28 from 麦客/v6

This commit is contained in:
麦客 2022-06-29 06:11:47 +00:00 committed by Gitee
commit b66707ce3e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -604,7 +604,7 @@ $(function () {
}; };
/*! 上传多张图片 */ /*! 上传多张图片 */
$.fn.uploadMultipleImage = function () { $.fn.uploadMultipleImage = function (num) {
return this.each(function () { return this.each(function () {
if ($(this).data('inited')) return true; else $(this).data('inited', true); if ($(this).data('inited')) return true; else $(this).data('inited', true);
var $in = $(this), $bt = $('<a data-file="mul" class="uploadimage"></a>'), imgs = this.value ? this.value.split('|') : [] var $in = $(this), $bt = $('<a data-file="mul" class="uploadimage"></a>'), imgs = this.value ? this.value.split('|') : []
@ -621,8 +621,10 @@ $(function () {
imgs = [], $bt.prevAll('.uploadimage').map(function () { imgs = [], $bt.prevAll('.uploadimage').map(function () {
imgs.push($(this).attr('data-tips-image')); imgs.push($(this).attr('data-tips-image'));
}); });
if(num>0 && imgs.length<num) $bt.show();
imgs.reverse(), $in.val(imgs.join('|')); imgs.reverse(), $in.val(imgs.join('|'));
}), $bt.before($image); }), $bt.before($image);
if(num>0&&imgs.length>=num) $bt.hide();
}); });
} }
}); });