设置允许最大上传限制

This commit is contained in:
zjl 2024-12-23 13:42:23 +08:00
parent fc16d8ca45
commit c02d3afc58

View File

@ -113,6 +113,9 @@
return props.disabled;
});
/**
* 文件列表
*/
const fileList = computed({
get: () => {
console.log(props.fileLists);
@ -138,6 +141,9 @@
const handleHttpUpload = async (options) => {
loading.value = true;
try {
//
onExceed();
//
const formData = new FormData();
formData.append('file', options.file.file);
formData.append('name', props.name);
@ -208,6 +214,9 @@
let filePath = props.name + '/' + year + '/' + month + '/' + day + '/' + fileName;
loading.value = true;
try {
//
onExceed();
//
const headers = {
'Access-Control-Allow-Origin': '*',
};
@ -325,12 +334,13 @@
* 最大上传张数限制
*/
const onExceed = () => {
if (props.limit) {
if (props.limit && fileList.value.length >= props.limit) {
notification.warning({
message: '温馨提示',
duration: 2000,
description: `最多支持上传${props.limit}`,
});
return false;
}
};