We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import myJsonp from 'jsonp'; // jsonp封装 export default function jsonp(url, data, paramURL = "") { const param = { "jsonParams": JSON.stringify(data), 'credithc-request-client-type': 'html5' } url = `${baseURL[paramURL]}${url}` url += (url.indexOf('?') < 0 ? '?' : '&') + params(param) return new Promise((resolve, reject) => { myJsonp(url, (err, data) => { if (!err) { resolve(data) } else { reject(err) } }) }) } export function params(data) { let url = ''; for (var k in data) { let value = data[k] !== undefined ? data[k] : '' url += `&${k}=${encodeURIComponent(value)}` } return url ? url.substring(1) : '' } // api 封装 export function getSome(param, paramURL = '') { // console.log('start') return api('/hyd/services/hydUser/smsCodeForLogin', param, paramURL).finally(() => { console.log('end') }) }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Promise 状态
一个处于 pending 态的 promise 是不可能转换成完成态(fulfilled)或拒绝态(rejected)的。 当这些状态发生的时候,会调用 promise 的 then 方法处理队列里的相关处理程序
Promise 封装 jsonp
The text was updated successfully, but these errors were encountered: