Cannot read property ‘cancelToken‘ of undefined“

tech2026-01-15  11

是因为在添加请求拦截器的时候,最后没有添加返回值return config方法 正确的写法应该是: axios.interceptors.request.use((config)=>{ if(getStore(‘token’)){ config.headers.Authorization=getStore(‘token’); } return config; },(error)=>{ console.log(error); });

最新回复(0)