新增多图上传最大允许数量验证

This commit is contained in:
zjl 2024-12-23 13:23:40 +08:00
parent dc02829e2a
commit 8bbe317f2e

View File

@ -120,6 +120,13 @@
const handleHttpUpload = async (options) => { const handleHttpUpload = async (options) => {
loading.value = true; loading.value = true;
try { try {
if (props.limit && props.fileList.length >= props.limit) {
notification.warning({
message: '温馨提示',
description: `最多支持上传${props.limit}`,
});
return false;
}
const formData = new FormData(); const formData = new FormData();
formData.append('file', options.file); formData.append('file', options.file);
formData.append('name', props.name); formData.append('name', props.name);
@ -188,6 +195,13 @@
let filePath = props.name + '/' + year + '/' + month + '/' + day + '/' + fileName; let filePath = props.name + '/' + year + '/' + month + '/' + day + '/' + fileName;
loading.value = true; loading.value = true;
try { try {
if (props.limit && props.fileList.length >= props.limit) {
notification.warning({
message: '温馨提示',
description: `最多支持上传${props.limit}`,
});
return false;
}
const headers = { const headers = {
'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Origin': '*',
}; };