小程序框架接口
小程序APP
App() 必须在 app.js 中调用,必须调用且只能调用一次。不然会出现无法预期的后果。
- < view>{{text}}</ view>
< view>{{array[0].msg}}</ view>
Page({
data: {
text: ‘init data’,
array: [{msg: ‘1’}, {msg: ‘2’}]
}
}) - 说明ARRAY是一个数组,而msg是数组的类或名,通过array[数字].类或名,就可以得到data中的数据
tabBar
-
pages 里面定义的必须是第一个,意思就是第一个定义的一定对应tabbar里面的第一个pagePath属性值
-
.json文件里面如果没有内容一定加上大括号
-
{
“pages”: [
“anniu1”,
“anniu2”,
“pages/index/index”,
“pages/logs/logs”],
“window”: {
“backgroundTextStyle”: “light”,
“backgroundColor”:"#FF0000",
“navigationBarBackgroundColor”: “#F00000”,
“navigationBarTitleText”: “小程序,我来了”,
“navigationBarTextStyle”: “white”
},
“tabBar”:{
“color”: “#9E9E9E”,
“selectedColor”: “#ff0000”,
“backgroundColor”: “#ff000f”,
“list”: [
{
“pagePath”: “anniu1”,
“text”: “主页”
},
{
“pagePath”: “anniu2”,
“text”: “目的地”
}
]
},
“sitemapLocation”: “sitemap.json”
}