![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
请求相关
胡占林
前端开发一枚
展开
-
前后端联调的规范(初级)
后端返回的状态 (1) -404/-500/-201/-403 等错误 (2) 网络/超时 等错误 (3) 返回 因为参数类型或者必传参数没传 等常规性错误 一般错误处理 在axios的封装函数中拦截 axios.interceptors.response.use(res => { // p2常规性错误捕获 }, err => { // p1错误捕获 // err.respo..原创 2021-07-27 18:44:33 · 451 阅读 · 0 评论 -
关于axios
关于axios 支持多个并发请求,当全部返回数据时,执行.then操作 axios.all([getUserAccount(), getUserPermissions()]) .then(axios.spread(function (acct, perms) { // 两个请求现在都执行完成 })) 添加responseType属性 可以是 ‘arraybuffer’, ‘blob’, ‘document’, ‘json’, ‘text’, ‘stream’ axios({ met原创 2021-03-10 13:54:13 · 65 阅读 · 0 评论