Skip to content

发起请求

GET

js
this.$get(url, data).then(res => {
  console.log(res)
  业务代码...
})

POST

js
this.$post(url, data).then(res => {
  console.log(res)
  业务代码...
})

内部封装示例

js
export function get(url, params = {}) {
  return axios({
    url,
    method: 'get',
    params
  })
}

export function post(url, data = {}) {
  return axios({
    url,
    method: 'post',
    data
  })
}

export function gdHttps(e) {
  return axios(e)
}

参数表

参数说明类型默认值
url请求地址Srting-
data请求的参数Object-