vue antd 手动上传upload ,限制文件个数为一个
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.fil
·
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;
},`
更多推荐
已为社区贡献4条内容
所有评论(0)