微信小程序开发
1.小程序中新增/减少页面,都需要对 pages 数组进行修改
默认的页面:
“pages”: [
“pages/index/index”,
“pages/logs/logs”
],
添加页面:
"pages": [
"pages/logs/logs2",
"pages/index/index",
"pages/logs/logs"
],
2.小程序根目录下的 app.json 文件用来对微信小程序进行全局配置。
“window”: {
“backgroundTextStyle”: “light”,//下拉 loading 的样式,
“navigationBarBackgroundColor”: “#0094ff”,//上部导航栏的背景色
“navigationBarTitleText”: “某某某”,//导航栏的标题
“navigationBarTextStyle”: “white”,//导航栏的字体样式
“enablePullDownRefresh”: true,//是否打开下拉刷新
“backgroundColor”: “#ffff”//设置下拉刷新的背景色
},
3.tabBar标签栏的设置
这里可以进入阿里图标官网添加链接描述搜索自己想要的图标。
"tabBar": {
"color": "#0094ff",
"selectedColor": "#ff9400",
"backgroundColor": "red",
"position": "bottom",
"borderStyle": "black",
"list": [{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "download/我的聚划算.png",
"selectedIconPath": "download/我的聚划算.png"
},
{
"pagePath": "pages/img/img",
"text": "收藏",
"iconPath": "download/聚收藏.png",
"selectedIconPath": "download/聚收藏.png"
},
{
"pagePath": "pages/mine/mine",
"text": "购物车",
"iconPath": "download/购物车.png",
"selectedIconPath": "download/购物车.png"
},
{
"pagePath": "pages/search/search",
"text": "收藏",
"iconPath": "download/二维码.png",
"selectedIconPath": "download/二维码.png"
}
]
},
相关代码的解释:
(1.)“color”: “#0094ff”,//tab 上的文字默认颜色,仅支持十六进制颜色
(2.)“selectedColor”: “#ff9400”,//tab 上的文字选中时的颜色
(3.)“backgroundColor”: “red”,//tab 的背景色,仅支持十六进制颜色
(4.) “position”: “bottom”,//tabBar 的位置,仅支持 bottom / top (5.)“borderStyle”: “black”,//tabbar 上边框的颜色, 仅支持 black / white
(6) “pagePath”: “pages/index/index”,//页面路径,必须在 pages 中先定义(7)“text”: “首页”,//tab 上按钮文字
(8)“iconPath”: “download/我的聚划算.png”,//图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px,不支持网络图片。当 position 为 top 时,不显示 icon。
(9) “selectedIconPath”: “download/我的聚划算.png”//选中时的图片路径