changzhn-jsonp
因为 `axios` 不支持 `jsonp`,所以封装一个自己用
Last updated 2 years 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 (2 years ago)

4 Versions

  • 1.0.4                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 8
Last Day 0
Last Week 5
Last Month 12
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |