侧边栏壁纸
  • 累计撰写 2,058 篇文章
  • 累计创建 73 个标签
  • 累计收到 20 条评论

目 录CONTENT

文章目录

uni-app的pages.json详细介绍说明

大猿本猿
2022-12-20 / 1,625 阅读 / 594 字
" "

pages.json 文件用来对 uni-app 进行全局配置,决定页面文件的路径、窗口表现、设置多 tab 等。

globalStyle Object 否 设置默认页面的窗口表现
pages Object Array 是 设置页面路径及窗口表现
tabBar Object 否 设置底部 tab 的表现
condition Object 否 启动模式配置

举例:

{
    "pages": [
        {
            "path": "pages/index/index",
            "style": {
                "navigationBarTitleText": "收银员",// 导航栏标题文字内容
                "backgroundTextStyle": "dark" ,//下拉 loading 的样式,仅支持 dark/light
                "enablePullDownRefresh":"false" ,//是否开启下拉刷新,详见页面相关事件处理函数
                "onReachBottomDistance":50 ,//页面上拉触底事件触发时距页面底部距离,单位为px 
                "backgroundColorTop":"#ffffff" ,//顶部窗口的背景色。 微信小程序且为 iOS
                "backgroundColorBottom":"#ffffff" ,//底部窗口的背景色。 微信小程序且为 iOS
            }
        },
        {
            "path": "pages/index/index",
            "style": {
                "navigationBarTitleText": "收银员",// 导航栏标题文字内容
                "backgroundTextStyle": "dark" ,//下拉 loading 的样式,仅支持 dark/light
                "enablePullDownRefresh":"false" ,//是否开启下拉刷新,详见页面相关事件处理函数
                "onReachBottomDistance":50 ,//页面上拉触底事件触发时距页面底部距离,单位为px 
                "backgroundColorTop":"#ffffff" ,//顶部窗口的背景色。 微信小程序且为 iOS
                "backgroundColorBottom":"#ffffff" ,//底部窗口的背景色。 微信小程序且为 iOS
            }

        }
    ],
    "globalStyle": {
        "navigationBarTextStyle": "black",//导航栏标题颜色,仅支持 black/white 
        "navigationBarTitleText": "uni-app",// 导航栏标题文字内容
        "navigationBarBackgroundColor": "#FFFFFF",//导航栏背景颜色
        "backgroundColor": "#F8F8F8",//窗口的背景色 微信小程序
        "navigationStyle":"default" ,//导航栏样式,仅支持 default/customm,开启 custom 后,所有窗口均无导航栏
    },
     "tabBar": {
        "color": "#7A7E83", //tab 上的文字默认颜色
        "selectedColor": "#3cc51f", //tab 上的文字选中时的颜色
        "borderStyle": "black", //tabbar 上边框的颜色,仅支持 black/white
        "backgroundColor": "#ffffff", //tab 的背景色
        "position":"bottom", //可选值 bottom、top
        "list": [{
          "pagePath": "pages/component/index", //页面路径,必须在 pages 中先定义
          "iconPath": "static/image/icon_component.png", //图片路径,icon 大小限制为40kb,建议尺寸为 81px * 81px,当 postion 为 top 时,此参数无效,不支持网络图片
          "selectedIconPath": "static/image/icon_component_HL.png", //选中时的图片路径,icon 大小限制为40kb,建议尺寸为 81px * 81px ,当 postion 为 top 时,此参数无效
          "text": "组件" //tab 上按钮文字
        }, {
          "pagePath": "pages/API/index",
          "iconPath": "static/image/icon_API.png",
          "selectedIconPath": "static/image/icon_API_HL.png",
          "text": "接口"
        }]
      }
}