vue + axios + formdata 上传文件带参数的爬坑之路

发布时间:2019-07-03 14:00:19发布者:Mr.Zhang阅读(291)

submitForm(event) {
 let formData = new FormData()
 formData.append('name', this.name)
 formData.append('age', this.age)
 formData.append('file', this.file)
let config = {
   headers: {
    'Content-Type': 'multipart/form-data;boundary = ' + new Date().getTime()
    } 
}
 this.$http.post('/myupload', formData, config).then(function (res) {
    if (res.status === 2000) {
     /*这里做处理*/
    }
 })
}

 





本文转自博客园,原文地址:https://www.cnblogs.com/yysbolg/p/11095831.html