vue请求接口示例

vue
WPing丶

2022-04-11 15:52

//vue请求接口示例
this.$http.get(Api.default.coupon_list,{
      params: {//传参
        mch_id: this.$route.query.mch_id
      }
    }).then((res) => {//请求成功
      if (res.data.code == 0) {
        this.$nextTick(() => {
          this.coupon_list = res.data.data.list
          if (res.data.data.list.length == 0) {
            this.show_no_data = true
          }
        })
      }
    }).catch((error) => {//请求失败
      console.log(error)
    }).then(() => {//回调函数
      this.$loading.hide()
    })


0 条评论

评论:

发送
0.103940s