mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
多图片上传设置最多可上传几张
This commit is contained in:
parent
99777cf7f1
commit
c069a8415b
@ -586,7 +586,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('|') : []
|
||||||
@ -604,8 +604,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();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user