app.json (写路由,头部有标题,tabBar菜单)
{ "pages": ["pages/index/index","pages/logs/index"],//路由 "window": { "backgroundTextStyle": "light", "navigationBarBackgroundColor": "#fff", "navigationBarTitleText": "首页",//标题 "navigationBarTextStyle": "black" }, //下方菜单栏 "tabBar": { "list": [ { "pagePath": "pages/index/index", "iconPath": "images/tabBar/tab_index.png",//未选中图标 "selectedIconPath": "images/tabBar/tab_index_.png",//选中图标 "text": "首页" }, { "pagePath": "pages/logs/index", "iconPath": "images/tabBar/tab_shop.png", "selectedIconPath": "images/tabBar/tab_shop_.png", "text": "展示" } ] }}修改头部标题(到对应页面的json文件如下修改)
{ "usingComponents": {}, "navigationBarTitleText": "展示"//想要显示的}常用指令:
{wx:for=""//for:循环指令,同volist 同wx:key一起使用wx:key=""//key:如:wxml在页面加载的时候加载了20条数据,然后通过页面下拉或者上拉的方法触发追加30条数据,小程序是在js对应方法里通过setData( data: xx.xx.xx)方法将 对应数据 拼接重置到对应变量中,这时页面数据会同步更新。在这个更新的过程中,如果循环数据中有wx:key的话,只会以追加的方法添加新数据,而原来在页面上已经加载的数据是不会再次被渲染的。wx:if=""//同其他if使用bindtap="aa"//点击事件::在对应js文件page({})中写上对应方法 aa:function(event){}<navigator url = "../aaa/aaa?id=1&name=2" ></navidator>//跳转传参,跳转到aaa目录下的aaa.wxml//生命周期函数--监听页面加载->接收参数 onLoad: function (options){ var that = this; that.setData({ id: options.id }) console.log(that.data.id) }}













