设置最大允许上传限制
This commit is contained in:
parent
8bbe317f2e
commit
e33c1fb937
@ -120,13 +120,9 @@
|
|||||||
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({
|
onExceed();
|
||||||
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);
|
||||||
@ -195,13 +191,9 @@
|
|||||||
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({
|
onExceed();
|
||||||
message: '温馨提示',
|
// 设置请求头
|
||||||
description: `最多支持上传${props.limit}张`,
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const headers = {
|
const headers = {
|
||||||
'Access-Control-Allow-Origin': '*',
|
'Access-Control-Allow-Origin': '*',
|
||||||
};
|
};
|
||||||
@ -313,11 +305,12 @@
|
|||||||
* 设置最大允许上传张数
|
* 设置最大允许上传张数
|
||||||
*/
|
*/
|
||||||
const onExceed = () => {
|
const onExceed = () => {
|
||||||
if (props.limit) {
|
if (props.limit && props.fileList.length >= props.limit) {
|
||||||
notification.warning({
|
notification.warning({
|
||||||
message: '温馨提示',
|
message: '温馨提示',
|
||||||
description: `最多支持上传${props.limit}张`,
|
description: `最多支持上传${props.limit}张`,
|
||||||
});
|
});
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user