1 getAll(id){
2 axios.defaults.withCredentials=true;
3     axios.get(`$请求地址}`)
4  .then(result => {
5       console.info( result );
6 }).catch(error => {
7       console.log('错误', error)
8   });
9 }
XMLHttpRequest.withCredentials 有什么用?
跨域请求是否提供凭据信息(cookie、HTTP认证及客户端SSL证明等)
也可以简单的理解为,当前请求为跨域类型时是否在请求中协带cookie。
 
注意:前端设置credentials属性后,要通知后端做允许,否则请求失败,状态200黑色

 

相关文章:

  • 2021-12-06
  • 2021-07-05
  • 2021-12-11
  • 2022-12-23
  • 2022-12-23
  • 2021-06-15
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-26
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案