{
"pages":[
"pages/page/home/index",
"pages/page/favor/index",
"pages/page/class/index",
"pages/page/user/index"
],
"window":{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "WeMall",//该属性在子页面下进行重写,在点击时候标题会改变,请注意看效果图顶部
"navigationBarTextStyle":"black"
},
"tabBar": {
"color": "#7A7E83",
"selectedColor": "#3cc51f",
"borderStyle": "black",
"backgroundColor": "#ffffff",
"list": [
{
"pagePath": "pages/page/home/index",
"iconPath": "pages/image/Home.png",
"selectedIconPath": "pages/image/SelectedHome.png",
"text": "首页"
},
{
"pagePath": "pages/page/class/index",
"iconPath": "pages/image/Class.png",
"selectedIconPath": "pages/image/SelectedClass.png",
"text": "分类"
},
{
"pagePath": "pages/page/favor/index",
"iconPath": "pages/image/Favor.png",
"selectedIconPath": "pages/image/SelectedFavor.png",
"text": "收藏"
},
{
"pagePath": "pages/page/user/index",
"iconPath": "pages/image/User.png",
"selectedIconPath": "pages/image/SelectedUser.png",
"text": "我的"
}
]
}
}
是的,到这里就结束了,四个导航的按钮选择效果便实现了,而且底部导航是与四个页面是联动的.不需要像安卓里面那样关联的处理.一直被安卓虐待的小伙伴,是不是有种受宠若惊的感觉?(笔者开始以为这个文件只是做了数据存储,却不成想竟然有了效果,激动~).
App({
/**
* 当小程序初始化完成时,会触发 onLaunch(全局只触发一次)
*/
onLaunch: function () {
},
/**
* 当小程序启动,或从后台进入前台显示,会触发 onShow
*/
onShow: function (options) {
},
/**
* 当小程序从前台进入后台,会触发 onHide
*/
onHide: function () {
},
/**
* 当小程序发生脚本错误,或者 api 调用失败时,会触发 onError 并带上错误信息
*/
onError: function (msg) {
}
})
https://developers.weixin.qq.com/miniprogram/dev/framework/view/wxss.html
如下是官方小程序的wxss文件,进行举例(未接触过css的小伙伴需要自己补充一下这一块的知识,菜鸟教程:https://www.runoob.com/css/css-text.html)
/* reset */
page {
background-color: #F8F8F8;
height: 100%;
font-size: 32rpx;
line-height: 1.6;
}
checkbox, radio{
margin-right: 10rpx;
}
button{
margin-top: 20rpx;
margin-bottom: 20rpx;
}
form{
width: 100%;
}
input {
width: 100%;
}
/* lib */
.strong{
font-weight: bold;
}
.tc{
text-align: center;
}
/* page */
.container {
display: flex;
flex-direction: column;
min-height: 100%;
justify-content: space-between;
font-size: 32rpx;
font-family: -apple-system-font,Helvetica Neue,Helvetica,sans-serif;
}