axios 设置超时时间 timeout

this.$ajax.post('', {operate: type, ids: this.data.id.toString(), data_type: 'ips'}, {timeout: 60000})
        .then(res => {
          if (res.status) {
            this.$message({
              message: '云操成功',
              type: 'success'
            })
          }
        })
        .catch(_ => {
          this.errMessage = (_ && _.data && Object.prototype.toString.call(_.data) === '[object Array]') ? _.data[0][Object.keys(_.data[0])[0]] : _.message
          this.$message.error(this.errMessage)
        })

猜你喜欢

转载自www.cnblogs.com/mengfangui/p/9195216.html
今日推荐