开始记录
本来应该是从9号就开始记录的。这段时间工作和学习节奏抓的有问题。
配置
{
"pages":[
"pages/index/index",
"pages/logs/logs",
"pages/details/details"
],
"window":{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "WeChat",
"navigationBarTextStyle":"black"
},
"tabBar": {
"list": [{
"pagePath": "pages/index/index",
"text": "首页"
}, {
"pagePath": "pages/logs/logs",
"text": "日志"
}]
}
}
pages是注册页面,有多少个页面就有多少个pages。需要注意跳转链接的页面和tabBar不能是相同页面!
<input placeholder="请输入运单号" bindinput="input"/>
"bindinput、bindtap"等是数据绑定。在wxml中声明数据绑定,在js中写方法函数
API
getExpressInfo:function(nu,cb){ wx.request({ url: ‘https://v.juhe.cn/exp/index?key=e251e4ec8a844a4cc1bef1f87f297ede&com=sf&no=‘+nu, //仅为示例,并非真实的接口地址 data: { x: ‘‘ , y: ‘‘ }, header: { //‘content-type‘: ‘application/json‘ ‘AppKey‘: ‘e251e4ec8a844a4cc1bef1f87f297ede‘ }, success: function(res) { //console.log(res.data) cb(res.data) } }) }
wx.request是微信的请求接口。注意要在后台配置请求发送的服务器地址。我采用了聚合数据提供的一个快递查询API接口。该方法是在app.js中写的参数是快递单号nu和返回数据cb
原文:http://www.cnblogs.com/cmys/p/6292474.html