微信小程序调用API简单案例-微信小程序api接口调用-微信小程序ibeacon
1.
微信小程序调用API,首先你带有一个api,推荐聚合数据,百度一下,认证注册一下,会获得一个API,还有appkey。
2.话不多说,在默认的index.js里写
3.onLoad:function(options){
4.wx.request({
5.url:'http://v.juhe.cn/toutiao/index',//API比如我调用了聚合头条api,这个是免费的
6.data:{
7.key:'你自己获得到的appkey'
8.},
9.header:{
10.'content-type':'application/json',//默认值
11.},
12.success:(res){
13.console.log(res)
14.},
15.fail:(err){
16.console.log(err)
17.}
18.})
19./*wx.showLoading({
20.title:'加载中',
21.})
22.//this.text();
23.*/
24.},
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。

