pages.json
这是配置路由的文件, 基本结构为:
{"pages": [{"path": "pages/Login","style": {"navigationBarTitleText": "登录","navigationStyle": "custom"}},{"path": "pages/Home","style": {"navigationBarTitleText": "首页","navigationStyle": "custom"}},{"path": "pages/Ucenter","style": {"navigationBarTitleText": "我的","navigationStyle": "custom"}}],"subPackages": [{"root": "package1","pages": [{"path": "page1","style": {"navigationBarTitleText": "page1"}}]}],"tabBar": {"color": "#7A7E83","selectedColor": "#3cc51f","borderStyle": "black","backgroundColor": "#ffffff","list": [{"pagePath": "pages/Home","iconPath": "static/tabbar/home1.svg","selectedIconPath": "static/tabbar/home2.svg","text": "首页"}, {"pagePath": "pages/Ucenter","iconPath": "static/tabbar/my1.svg","selectedIconPath": "static/tabbar/my2.svg","text": "我的"}]},"globalStyle": {"navigationBarTextStyle": "black","navigationBarTitleText": "uni-app","navigationBarBackgroundColor": "#F8F8F8","backgroundColor": "#F8F8F8"}}
各节点的属性包括:
页面配置
通过 pages 进行页面配置
包括以下属性
path页面路径style页面默认样式
其中 style 包括以下属性:
navigationBarTitleText标题栏文字navigationStyle可选 default/custom, 默认 default, custom 即取消默认的原生导航栏disableScroll是否允许页面滚动, 默认trueenablePullDownRefresh是否开启下拉刷新, 默认falseonReachBottomDistance页面上拉触底事件触发时距页面底部距离,单位只支持px
子包
通过 subPackages 进行子包配置,主要针对于微信小程序
包括以下属性:
root子包根目录pages同根下的pages
底部导航
通过 tabBar 配置底部导航
包括以下属性:
color未被选择的tab文字颜色selectedColor被选择的tab文字颜色borderStyle边框色backgroundColor背景色list底部导航的页面
其中 list 包括以下属性:
pagePath页面路径iconPath未激活的图标路径selectedIconPath激活的图标路径text文字
全局样式
globalStyle 用于配置默认的全局页面样式,可被 pages[].style 覆盖
包括以下属性:
navigationBarBackgroundColor导航栏背景颜色 (同状态栏背景色)navigationBarTextStyle导航栏标题颜色及状态栏前景颜色,仅支持black/whitenavigationBarTitleText导航栏标题文字内容backgroundColor窗口的背景色 (仅微信小程序支持)enablePullDownRefresh是否开启下拉刷新, 默认falseonReachBottomDistance页面上拉触底事件触发时距页面底部距离,单位只支持px
