changzhn-jsonp
因为 `axios` 不支持 `jsonp`,所以封装一个自己用
Last updated a year ago by changzhn .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install changzhn-jsonp 
SYNC missed versions from official npm registry.

jsonp方法

因为 axios 不支持 jsonp,所以封装一个自己用

npm i changzhn-jsonp -S

和后台约定从url中取回调函数名的key,传到第二个参数中。{cb: 'callback},其他请求参数也加到这个对象中,函数返回一个promise

import jsonp from 'changzhn-jsonp'

jsonp(url, {}).then(res => {
  console.log(res);
}).catch(e => {
  console.error(e);
});

Current Tags

  • 1.0.4                                ...           latest (a year ago)

4 Versions

  • 1.0.4                                ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 3
This Month 9
Last Day 0
Last Week 5
Last Month 5
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |