# antd Upload 组件拖拽上传如何校验格式
onDrop(e) {
const files = Array.from(e.dataTransfer.files) || [];
const hasNotVttFiles = files.some(file => file.type !== "text/vtt");
if (hasNotVttFiles) {
message.error("请上传.vtt文件");
return;
}
}
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8