【发布时间】:2019-05-24 16:16:03
【问题描述】:
我想在我的 axios 帖子中添加多个参数。我该怎么做?
我在这里尝试
axios.post('/select-files', this.$data.single, formData, config)
.then((response) => {
alert('Data Single Successfull Inserted.')
console.log(response);
})
我当前的代码只返回来自this.$data.single 的数据。
如果我像 formData, this.$data.single, config 这样更改代码,那么我的代码将只返回来自 formData 的数据
formdata 是返回这个数据
formData.append('image', this.image);
this.$data.single返回此数据
data() {
return {
files: [],
errors: [],
artistname: [],
single: {},
image: '',
success: '',
artist: [],
showinput: [],
searchText: '',
items: [],
lastSelectItem: {}
}
},
而config 是
const config = {
headers: { 'content-type': 'multipart/form-data' }
}
这不是我的完整代码。
【问题讨论】: