1.配置tabbar
"tabBar": {
"list": [{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "assets/icons/index.png",
"selectedIconPath": "assets/icons/index-active.png"
},{
"pagePath": "pages/my/index",
"text": "我的",
"iconPath": "assets/icons/wode.png",
"selectedIconPath": "assets/icons/wode-active.png"
}]
},
页面最少两个
2.事件
<view bindtap="handleTap">点击事件</view>
<view bind:tap="handleTap">另一种写法</view>
事件传参
<view bindtap="handleTap" data-msg="我是事件的参数">点击事件</view>
handleTap(e){
console.log("执行了点击事件");
// 通过currentTarget中的dataset属性可以获取时间参数
console.log(e.currentTarget.dataset.msg);
}
currentTarget是当前事件所绑定的事件
target则是触发该事件的源头组件