mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2026-07-13 19:01:06 +08:00
上传多图增加data-number 可设置数量
This commit is contained in:
parent
209c9b8a1a
commit
99798ae191
@ -588,7 +588,7 @@ $(function () {
|
||||
$.fn.uploadMultipleImage = function () {
|
||||
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('|') : []
|
||||
var $in = $(this), $bt = $('<a data-file="mul" class="uploadimage"></a>'), imgs = this.value ? this.value.split('|') : [], num = $in.data('number') || 0
|
||||
$in.after($bt.attr('data-size', $in.data('size') || 0).attr('data-type', $in.data('type') || 'png,jpg,gif,jpeg').uploadFile(function (src) {
|
||||
imgs.push(src), $in.val(imgs.join('|')), showImageContainer([src]);
|
||||
})), (imgs.length > 0 && showImageContainer(imgs));
|
||||
@ -603,8 +603,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();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user