Это компонент HTML:
<a-upload-dragger
name="file"
:multiple="true"
:customRequest="uploadfiles"
@change="handleChange">
</a-upload-dragger>
Вам необходимо обработать customRequest:
uploadfiles({ onSuccess, onError, file }) {
this.upload(file)
.then(() => {
onSuccess(null, file);
})
.catch(() => {
console.log('error');
});
};
Файл имеет такую структуру:
name: "YourFileName.txt"
lastModified: ...
lastModifiedDate: ...
webkitRelativePath: ""
size: 24
type: "text/plain"
uid: "vc-upload-xxxxxx..."
Вы можете реализовать собственную функцию загрузки.
Вы можете обрабатывать изменения состояния процесса загрузки файла:
handleChange(info) {
const status = info.file.status;
if (status !== 'uploading') {
// show update progress console.log(info.file, info.fileList);
}
if (status === 'done') {
// show success message
} else if (status === 'error') {
// show error message
}
}