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

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) {
     /*这里做处理*/
    }
 })
}

 

版权声明: 本文由 ```...裥簞點 发表于 bloghome博客

转载声明: 可自由转载、引用,但需要属名作者且注明文章出处。

文章链接: https://www.bloghome.com.cn/user/yysblog

posted @ 2019-07-03 08:36  全栈九九六  阅读(7532)  评论(0编辑  收藏  举报