1.0.1 • Published 6 years ago

cross-get-api v1.0.1

Weekly downloads
1
License
ISC
Repository
-
Last release
6 years ago

简介

封装了 JsonBird 提供的接口, 可以解决一些公共 Api 访问跨域的问题。 依赖 axios 写的,所以需要先安装 axios

安装

npm install npm-bird-api axios qs -S

使用

import { getData } from 'npm-bird-api'

let url = 'xxxx' // 你要访问的接口地址
let methods = 'GET' // 默认是get,暂未支持POST
let data = 'xxx' // 传入的data值

getData({url, methods, data}).then(res => {
    // 访问成功后的数据
    console.log(res)
}).catch(err => {
    console.log(err)
})
1.0.1

6 years ago

1.0.0

6 years ago