-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
请问一下上传图片的请求头怎么配置?我们项目请求需要传token #78
Comments
暂不支持自定义header,你需要自定义customUploader |
我自定义了customUploader,并且已经能成功打印出来,但是并没有生效。 customUploader.js如下: import {getToken} from '@/utils/token'; const token = getToken(); var getError = function getError(options, xhr) {
};
}; export default{
}; 下面是业务页面的调用:
|
customUploader放置在image下边和uploader平级的。 |
请问一下上传图片的请求头怎么配置?我们项目请求需要传token,按一般的设置请求头的方法是无效的。
image:{
uploader:{
url:baseURL + "/bms/img_upload",
name:"file",
// headers:'Bearer ' + token,
// 这种无效
headers: (xhr) => {
xhr.setRequestHeader('Authorization','Bearer ' + token);
},
// 这种也无效
response: (res) => {
console.log(res);
return res.data
},
filter:(res)=> {
console.log(res);
}
}
}
The text was updated successfully, but these errors were encountered: