axios发送请求的参数,该属性用于配置发送跨域请求时是否携带cokkie。不跨域的请求默认携带cookie。
例:
- axios( url: '***', method: 'post', withcredentials: true ) //携带cookie
- axios( url: '***', method: 'post', withcredentials: false ) //不携带cookie
也可以通过以下方式设置:
axios.defaults.withCredentials = true;