1.参数:传递一个数组
recursiveUpload(files) {
let upload_data = new FormData();
const len = files.length;
if (this.current_index < len) {
upload_data.append("file", files[this.current_index]);
Service.uploadTheme(upload_data)
.then((res) => {
if (res) {
this.current_index++;
this.recursiveUpload(files);
}
})
.catch(() => {
this.disabledUpload = false;
this.message.close();
});
} else {
this.current_index = 0;
this.message.close();
this.disabledUpload = false;
this.$message({
message: "上传成功",
type: "success",
showClose: true,
});
}
},
网友评论