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
可封装到api.js中,然后在外部使用时导入模块
const githubHost = 'https://api.github.com/';//github接口域名 var githubApi = { userUrl: function(githubName) { //console.log('调用了这个模块'); return githubHost + 'users/' + githubName; }, repoUrl: function(githubName) { return this.userUrl(githubName) + '/repos?per_page=100'; }, prUrl: function (githubName) { return githubHost + 'search/issues?q=type:pr+is:merged+author:' + githubName + '&per_page=100'; } } //对wx.request进行封装为promise对象 function fetch(url) { console.log("fetch start"); return new Promise(function(resolve, reject) { wx.request({ url: url, method: 'GET', header: { 'content-type': 'application/json' }, success: (res) => { console.log("success"); res.ok = true; resolve(res); }, fail: () => { console.log("fail"); reject(); } }); }) } module.exports = { githubApi: githubApi, fetch: fetch }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
可封装到api.js中,然后在外部使用时导入模块
The text was updated successfully, but these errors were encountered: