@deepjs/jsonp

0.2.9 • Public • Published

JSONP

独立包,功能强大,使用简单

使用

// app.js 引入
import jsonp from '@deepjs/jsonp'
import axios from 'axios'

// axios.jsonp = jsonp;

const params = {
  ak: 'BAIDU_MAP_AK',
  location: `${lat},${lng}`,
  coord_type: 'gcj02',
  output: 'json',
  s: 1,
}
const url = `https://api.map.baidu.com/geocoder/v2/?${qs.stringify(params)}`
jsonp(url).then(res => {
  const { result } = res
  const {
    cityCode = '', // 城市code
    province = '', // 省
    city = '',     // 市
    district = '', // 区
    street = '',   // 路
    street_number = '', // 号
  } = result.addressComponent

  // ...
})

Readme

Keywords

Package Sidebar

Install

npm i @deepjs/jsonp

Weekly Downloads

3

Version

0.2.9

License

MIT

Unpacked Size

2.17 kB

Total Files

3

Last publish

Collaborators

  • cloudyan