1.0.6 • Published 3 years ago

axios-weixin v1.0.6

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

安装

npm install axios-weixin

导入

import Axios from 'axios-weixin'

使用

// 定义基本配置对象
const request = Axios.create({
  // 基准地址
  baseURL: ''
})

// 请求拦截器
request.interceptors.request.use(
  config => {
    return config
  },
  error => {
    return Promise.reject(error)
  }
)

// 响应拦截器
request.interceptors.response.use(
  config => {
    return config.data
  },
  error => {
    return Promise.reject(error)
  }
)

发起请求(返回结果都为 promise)

request({
  method: 'GET',
  url: '/my/indexData'
  data: {
    ...
  },
  header: {
    ...
  }
})

request.get({
  url:'/my/indexData',
  data: {
    ...
  }
})

request.post({
  url:'/my/indexData',
  data: {
    ...
  }
})

request.delete({
  url:'/my/indexData',
  data: {
    ...
  }
})

request.put({
  url:'/my/indexData',
  data: {
    ...
  }
})

开源协议

ISC

1.0.6

3 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago