this.fileList = this.fileList.slice(-1);

例子:`

beforeUpload(file, fileList) {
console.log(fileList);
this.fileList = […this.fileList, file];
console.log(file);
console.log(this.fileList);
//限制文件只能上传一个
this.fileList = this.fileList.slice(-1);
const isZip = file.type.includes(“zip”);
if (!isZip) {
this.fileList = [];
this.$message.error(“只能上传zip格式的文件”);
}
return false;
},`

Logo

前往低代码交流专区

更多推荐