国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > HTML > 正文

前端獲取http狀態碼400的返回值實例

2020-10-23 18:27:22
字體:
來源:轉載
供稿:網友

如下所示:

axios.get("/check_mobile_and_sent_code",{withCredentials:true,params:{mobile:formInline.mobile}}).then(res=>{            console.log(res);            //if(res.result==true){              if (!this.timer) {                this.count = this.TIME_COUNT;                this.show = false;                this.timer = setInterval(() => {                  if (this.count > 0 && this.count <= this.TIME_COUNT) {                    this.count--;                  } else {                    this.show = true;                    clearInterval(this.timer);                    this.timer = null;                  }                }, 1000)              }            //}          }).catch(error=>{            console.log(error.response.data);            console.log(error.response.status);            console.log(error.response.headers);             console.log('Error', error.message);            console.log(error.config);          })

使用場景:

當后端判斷驗證的手機號已存在的時候會返回400,這時需要跳到error條件中,得到后臺400的返回數據如上。

以下是error.response返回值:

這里如果直接輸出error,等于error.message

附狀態碼為200的返回值:

以上這篇前端獲取http狀態碼400的返回值實例就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持武林網。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 咸丰县| 寿光市| 宜宾市| 安仁县| 嘉荫县| 根河市| 沂源县| 岳池县| 利津县| 霍邱县| 金寨县| 娱乐| 德格县| 宣恩县| 河东区| 饶河县| 民县| 大庆市| 新密市| 班玛县| 新宁县| 罗江县| 房山区| 高碑店市| 油尖旺区| 六枝特区| 靖边县| 勃利县| 金秀| 台安县| 河东区| 武宣县| 通江县| 铜山县| 土默特左旗| 南宫市| 新绛县| 德昌县| 德清县| 德清县| 巴彦淖尔市|