function handleDownload(file: any) {
//点击文件列表中已上传的文件时的钩子
const type = 'application/' + getfileType(file.url);
const url = window.URL.createObjectURL(new Blob([file.response], { type }));
const a = document.createElement('a');
a.href = url;
a.target = '_blank';
a.download = file.name;
a.click();
a.remove();
}
拿到文件
const getfileType = (filePath: string) => {
return filePath.substring(filePath.lastIndexOf('.') + 1);
};