当前位置:网站首页>小程序全局配置
小程序全局配置
2022-07-05 20:19:00 【'wx】
小程序根目录下的app.json文件是小程序的全局配置文件。常用配置项如下:
1.pages
记录当前小程序所有页面的存放路径
2.window
全局设置小程序窗口的外观
3.tabBar
设置小程序底部的tarBar效果
4.style
是否启用新版的组件样式
2.了解window节点常用的配置项
属性名 | 类型 | 默认值 | 说明 |
navigationBarTitleText | String | 字符串 | 导航栏标题文字内容 |
navigationBarBackgroundColor | HexColor | #000000 | 导航栏背景颜色,如 #000000 |
navigationBarTextStyle | String | white | 导航栏标题颜色,仅支持 black / white |
backgroundColor | HexColor | #ffffff | 窗口的背景色 |
backgroundTextStyle | String | dark | 下拉 loading 的样式,仅支持 dark / light |
enablePullDownRefresh | Boolean | false | 是否全局开启下拉刷新 |
onReachBottomDistance | Number | 50 | 页面上拉触底事件触发时距 页面底部距离,单位为px |
"window":{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#bfa",
"navigationBarTitleText": "wx",
"navigationBarTextStyle":"black",
"backgroundColor": "#bfa",
"enablePullDownRefresh": true
},
3.tabBar
tabBar是移动端应用常见的页面效果,用于实现多页面的快速切换(tabBar中只能由2-5个tab页签,只有底部tabBar才会显示icon图标)
tabBar6个组成部分
tabBar节点的配置项
属性 | 类型 | 必填 | 默认值 | 描述 |
position | String | 否 | bottom | tabBar 的位置,仅支持 bottom/top |
borderStyle | String | 否 | black | tabBar 上边框的颜色,仅支持 black/white |
color | HexColor | 否 | tab 上文字的默认(未选中) 颜色 | |
selectedColor | HexColor | 否 | tab 上的文字选中时的颜色 | |
backgroundColor | HexColor | 否 | tabBar 的背景色 | |
list | Array | 是 | tab 页签的列表, 最少 2 个、最多 5 个 tab |
"tabBar": {
"list":[
{
"pagePath": "pages/home/home",
"text": "主页",
"iconPath": "/images/home.png",
"selectedIconPath": "/images/home-active.png"
},
{
"pagePath": "pages/message/message",
"text": "消息",
"iconPath": "/images/message.png",
"selectedIconPath": "/images/message-active.png"
},
{
"pagePath": "pages/contact/contact",
"text": "联系我们",
"iconPath": "/images/contact.png",
"selectedIconPath": "/images/contact-active.png"
}
]
},
每个tab项的配置选项
属性 | 类型 | 必填 | 描述 |
pagePath | String | 是 | 页面路径,页面必须在 pages 中预先定义 |
text | String | 是 | tab 上显示的文字 |
iconPath | String | 否 | 未选中时的图标路径;当 postion 为 top 时,不显示 icon |
selectedIconPath | String | 否 | 选中时的图标路径;当 postion 为 top 时,不显示 icon |
边栏推荐
- Is it safe for CICC fortune to open an account online?
- 【数字IC验证快速入门】8、数字IC中的典型电路及其对应的Verilog描述方法
- 《乔布斯传》英文原著重点词汇笔记(十二)【 chapter ten & eleven】
- [C language] three implementations of quick sorting and optimization details
- js方法传Long类型id值时会出现精确损失
- 基金网上开户安全吗?去哪里开,可以拿到低佣金?
- Leetcode brush questions: binary tree 11 (balanced binary tree)
- Go language | 02 for loop and the use of common functions
- 1: Citation;
- [C language] merge sort
猜你喜欢
js实现禁止网页缩放(Ctrl+鼠标、+、-缩放有效亲测)
港股将迎“最牛十元店“,名创优品能借IPO突围?
- Oui. Net Distributed Transaction and Landing Solution
Informatics Orsay all in one 1339: [example 3-4] find the post order traversal | Valley p1827 [usaco3.4] American Heritage
关于BRAM IP复位的优先级
leetcode刷题:二叉树12(二叉树的所有路径)
【愚公系列】2022年7月 Go教学课程 004-Go代码注释
PyTorch 1.12发布,正式支持苹果M1芯片GPU加速,修复众多Bug
Scala basics [HelloWorld code parsing, variables and identifiers]
ROS2专题【01】:win10上安装ROS2
随机推荐
sun.misc.BASE64Encoder报错解决方法[通俗易懂]
kubernetes资源对象介绍及常用命令(五)-(ConfigMap&Secret)
y57.第三章 Kubernetes从入门到精通 -- 业务镜像版本升级及回滚(三十)
[quick start of Digital IC Verification] 1. Talk about Digital IC Verification, understand the contents of the column, and clarify the learning objectives
CTF逆向基础
【c语言】归并排序
[quick start of Digital IC Verification] 7. Basic knowledge of digital circuits necessary for verification positions (including common interview questions)
B站UP搭建世界首个纯红石神经网络、基于深度学习动作识别的色情检测、陈天奇《机器学编译MLC》课程进展、AI前沿论文 | ShowMeAI资讯日报 #07.05
Ffplay document [easy to understand]
Introduction to dead letter queue (two consumers, one producer)
Station B up builds the world's first pure red stone neural network, pornographic detection based on deep learning action recognition, Chen Tianqi's course progress of machine science compilation MLC,
July 4, 2022 - July 10, 2022 (UE4 video tutorial MySQL)
c語言oj得pe,ACM入門之OJ~
【愚公系列】2022年7月 Go教学课程 004-Go代码注释
炒股开户最低佣金,低佣金开户去哪里手机上开户安全吗
Scala basics [HelloWorld code parsing, variables and identifiers]
Sort and projection
Leetcode skimming: binary tree 10 (number of nodes of a complete binary tree)
CVPR 2022 | 常见3D损坏和数据增强
Go language | 02 for loop and the use of common functions