久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術文章
文章詳情頁

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

瀏覽:230日期:2022-06-02 18:11:14

如下所示:

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的返回值實例就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持。

標簽: CSS HTML
相關文章:
主站蜘蛛池模板: 长海县| 抚顺县| 潜江市| 乌兰浩特市| 巨鹿县| 东山县| 岳阳县| 湖南省| 英山县| 延边| 德江县| 开封市| 临夏市| 大邑县| 绥中县| 上蔡县| 兰溪市| 黔江区| 桦南县| 百色市| 东海县| 宁南县| 叶城县| 特克斯县| 南郑县| 翼城县| 浠水县| 怀集县| 九龙坡区| 海原县| 佛学| 财经| 朝阳县| 巩留县| 富平县| 三穗县| 湛江市| 德安县| 隆化县| 哈巴河县| 峨眉山市|