page.json必有属性只有一个page,其余都是非必要属性。
page属性有两大部分path和style
path必有,是从项目根目录开始的路径(没有vue文件后缀)
style必有,但是可以为空,是描述对应页面的样式的属性。
"pages": [
{
"path": "pages/index/index",
"style": { ... }
}, {
"path": "pages/login/login",
"style": { ... }
}
]
以下为非必要,但是常用属性
- easycom是可有可无的,代表组件自动引入规则。
- globalStyle是窗口默认样式,覆盖所有窗口,但是会被page中的style(上文)重载,覆盖样式。
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "高阳",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
}
- tabBar 配置项指定一级导航栏,以及 tab 切换时显示的对应页。(性能好)。最少俩,最多五个。
(内部属性较多,可查询 https://uniapp.dcloud.io/collocation/pages?id=tabbar
)
"tabBar":{
"color":"black",
"selectColor":"yellow",
"bordercolor":"white",
"list":[
{
"pagePath":"pages/index/index",
"iconPath":"static/tabbar/index.png",
"selectedIconPath":"static/tabbar/selectedIndex.png",
"text":"首页"
},
{
"pagePath":"pages/my/my",
"iconPath":"static/tabbar/index.png",
"selectedIconPath":"static/tabbar/selectedIndex.png",
"text":"my"
},
{
"pagePath":"pages/class/class",
"iconPath":"static/tabbar/index.png",
"selectedIconPath":"static/tabbar/selectedIndex.png",
"text":"class"
},
{
"pagePath":"pages/cart/cart",
"iconPath":"static/tabbar/index.png",
"selectedIconPath":"static/tabbar/selectedIndex.png",
"text":"cart"
}
]
}
- condition,开发设置。(我的理解就是,调打开时候的首页,和初始化参数)。
其余属性不常用,详情参考文档
https://uniapp.dcloud.io/collocation/pages?id=%e9%85%8d%e7%bd%ae%e9%a1%b9%e5%88%97%e8%a1%a8