pages.json
{
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "web2208",
"app-plus":{//配置编译到App平台时的特定样式,部分常用配置H5平台也支持
"titleNView":{//导航栏
"searchInput":{//原生导航栏上的搜索框配置
"placeholder":"请输入搜索内容",
"disabled":true
},
"buttons":[
{
"float":"left",
"fontSrc":"/static/font/iconfont.ttf",//按钮上文字使用的字体文件路径
"text":"\ue67a",//按钮上显示的文字,字体图标'\u'开头
"color":"#666"
},
{
"float":"right",
"fontSrc":"/static/font/iconfont.ttf",
"text":"\ue661",
"color":"#666"
}
]
}
}
}
}, {
"path": "pages/cart/cart",
"style": {}
}, {
"path": "pages/cate/cate",
"style": {}
}, {
"path": "pages/myfile/myfile",
"style": {}
}
,{
"path" : "pages/search/search",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
],
// 全局配置
"globalStyle": {
"navigationBarTextStyle": "black",//导航栏标题颜色及状态栏前景颜色,仅支持 black/white
"navigationBarTitleText": "uni-app",//导航栏标题文字内容
"navigationBarBackgroundColor": "#F8F8F8",//导航栏背景颜色
"backgroundColor": "#F8F8F8"//下拉显示出来的窗口的背景色
},
"tabBar": {
"color": "#7A7E83",
"selectedColor": "#f60",
"borderStyle": "black",//tabbar上边框的颜色,可选值 black/white
"backgroundColor": "#ffffff",
"list": [{//最少2个、最多5个
"pagePath": "pages/index/index",
"iconPath": "static/tabbar/index.png",
"selectedIconPath": "static/tabbar/indexSelected.png",
"text": "首页"
}, {
"pagePath": "pages/cate/cate",
"iconPath": "static/tabbar/class.png",
"selectedIconPath": "static/tabbar/classSelected.png",
"text": "分类"
},
{
"pagePath": "pages/cart/cart",
"iconPath": "static/tabbar/cart.png",
"selectedIconPath": "static/tabbar/cartSelected.png",
"text": "购物车"
}, {
"pagePath": "pages/myfile/myfile",
"iconPath": "static/tabbar/my.png",
"selectedIconPath": "static/tabbar/mySelected.png",
"text": "我的"
}
]
}
}
"app-plus"仅h5和APP平台显示,小程序端需在vue文件中另行单独写
<!-- #ifdef MP-WEIXIN -->
<!-- 该内容仅在微信小程序端显示 -->
<!-- #endif -->
<!-- #ifdef MP -->
<!-- 该内容仅在小程序端显示 -->
<!-- #endif -->
路由与页面跳转
uni.switchTab 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面
监听原生标题栏搜索输入框事件
onNavigationBarSearchInputChanged 输入内容变化
onNavigationBarSearchInputConfirmed 用户点击软键盘上的“搜索”按钮时触发
onNavigationBarSearchInputClicked 输入框被点击且 isabled 为 true 时才会触发