axios 异常捕获

1.

 this.$http.post('/proxy/eventMonitorLog/cancelEventMonitorByCode', {
        "wardCode": this.$store.getters.env().wardCode
      }).then(response=>{       
      }).catch(error=>{
        console.log(error)       
      })

2.

try {
        let response = await this.$http
        .post('/proxy/eventMonitorLog/getEventMonitorListByCode', { wardCode: this.$store.getters.env().wardCode })
        this.outBedsData = response.data.body
        loadingInstance.close()
      } catch (error) {
        console.log(error)
      }

  

原文地址:https://www.cnblogs.com/ckmouse/p/12671786.html