微信小程序--app.json全局配置文件
程序员文章站
2024-03-18 14:02:04
...
enablePullDownRefresh 是否开启当前页面下拉刷新。只有开启这个属性,backgroundTextStyle和backgroundColor这两个属性才能看到,这两个属性都是设置的,当页面下拉刷新时出现的区域的样式,可以自己尝试一下,写上以上样式后更改属性值,即可看到
"window":{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#666",
"navigationBarTitleText": "微信接口功能演示",
"navigationBarTextStyle":"black",
"backgroundColor":"yellow",
"enablePullDownRefresh":true
},
tabBar 就是底部的图标:
tabBar一定和pages,window是同级别的
第一个参数pagePath 是点击图标之后链接的地址,和pages里面存放的页面地址是对应的
第二个参数text 是图标下面的文字
第三个参数是iconPath 未被选中图标的图片地址
第四个参数是selectedIconPath 选中图标的图片地址
如果想要修改tabBar的文字以及背景颜色,要和list同级别
要注意:当 position 为 top 时,不显示 icon。如下图所示
app.json文件
{
"pages":[
"pages/index/index",
"pages/demo01/demo01",
"pages/logs/logs",
"pages/aixin/aixin",
"pages/bangzhu/bangzhu",
"pages/banji/bianji",
"pages/chuangzuo/chaungzuo"
],
"window":{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#666",
"navigationBarTitleText": "微信接口功能演示",
"navigationBarTextStyle":"black",
"backgroundColor":"yellow",
"enablePullDownRefresh":true
},
"tabBar": {
"list": [
{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "icon/aixin.png",
"selectedIconPath": "icon/_aixin.png"
},
{
"pagePath": "pages/banji/bianji",
"text": "编辑",
"iconPath": "icon/bianji.png",
"selectedIconPath": "icon/_bianji.png"
},
{
"pagePath": "pages/bangzhu/bangzhu",
"text": "帮助",
"iconPath": "icon/bangzhu.png",
"selectedIconPath": "icon/_bangzhu.png"
}
],
"backgroundColor": "#ff9400",
"color": "#ffffff",
"position":"top"
},
"style": "v2",
"sitemapLocation": "sitemap.json"
}