How to set callback by vue-resource timeout

my project introduces vue2.min.js and vue-resource.min.js files. How can I set the callback function?

      this.$http.post(url, {
        keywords : [
          { "key" : key, "limit" : 50 }
        ]
      },{timeout : 3000}).then(function(res) {
          console.log(res)
      },function(err){
          console.log(err)
      })

       
May.04,2021



Vue.http.interceptors.push(function(request, next) {
    var timeout
    if (request.timeout) {
      clearTimeout(timeout)
      timeout = setTimeout(function() {
        console.log('')
        request.abort()
      }.bind(this), request.timeout)
    }
    next(function(response) {
      return response
    })
  })
Menu