let url = this.globalAPIBaseUrl + 'program/' + this.tmsID + '/updateposters/?posterType=' + imageType;
let j = [{
posterType: imageType,
url: imageUrl
}];
axios.patch(url, {
headers: {
Authorization: 'Bearer ' + localStorage.getItem('accessToken')
}
}, j, {
onUploadProgress: progressEvent => {
this.basic.status = 'Uploaded: ' + progressEvent.loaded + 'b of ' + progressEvent.total + 'b'
}
}).then(response => (this.handleUploadComplete(response)));
在我放入“标头”之前,它工作正常,当我使用相同的auth标头,但在其他地方没有“ j”数据变量时,它也能正常工作。
任何建议,我对axios都很陌生。 (这是在vue2.js中)
答案 0 :(得分:1)
public MyAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent,
int viewType) {
// create a new view
TextView v = (TextView) LayoutInflater.from(parent.getContext())
.inflate(R.layout.my_text_view, parent, false);
...
MyViewHolder vh = new MyViewHolder(v);
return vh;
}
应该是第二个参数,第三个参数是data
对象,您可以在其中设置config
和headers
回调
onUploadProgress