多图片上传设置最多可上传几张

This commit is contained in:
Administrator 2022-04-19 12:35:34 +08:00
parent 99777cf7f1
commit c069a8415b

View File

@ -586,7 +586,7 @@ $(function () {
};
/*! 上传多张图片 */
$.fn.uploadMultipleImage = function () {
$.fn.uploadMultipleImage = function (num) {
return this.each(function () {
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('|') : []
@ -604,8 +604,10 @@ $(function () {
imgs = [], $bt.prevAll('.uploadimage').map(function () {
imgs.push($(this).attr('data-tips-image'));
});
if(num>0 && imgs.length<num) $bt.show();
imgs.reverse(), $in.val(imgs.join('|'));
}), $bt.before($image);
if(num>0&&imgs.length>=num) $bt.hide();
});
}
});