uni-app pages.json配置和tabBar使用

pages.json 配置页面

{
    "pages": [ //pages数组中第一项表示应用启动页,可以随时换成自己想要的默认的启动页
        {
            "path": "pages/index/index",
            "style": {
                "navigationBarTitleText": "uni-app"
            }
        },
        {//每建立一个.vue页面都要在pages中建立一套
            "path": "pages/about/about",
            "style": {
                "navigationBarTitleText": "uni about"
            }
        }
    ],
    "globalStyle": {//全局的样式
        "navigationBarTextStyle": "black",//导航栏标题颜色
        "navigationBarTitleText": "uni-app", //导航栏标题文字内容
        "navigationBarBackgroundColor": "#F8F8F8",//导航栏背景颜色
        "backgroundColor": "#F8F8F8",//窗口的背景色 微信小程序
        "navigationStyle":"default",//导航栏样式,仅支持 default/custom,开启custom后,所有窗口均无导航栏。
    }
}

tabBar

color:tab上的文字默认颜色

selectabColor : 是tab上的文字选中时的颜色

backgroundColor:  tab的背景色

borderStyle : tabbar上边狂的颜色,仅支持black/white

list:   array是tab的列表,详见list属性说明,最少2个,最多5个tab

posiston:  可选值bottom、top

{
    "pages": [ //pages数组中第一项表示应用启动页,可以随时换成自己想要的默认的启动页
        {
            "path": "pages/index/index",
            "style": {
                "navigationBarTitleText": "主页"
            }
        },
        {//每建立一个.vue页面都要在pages中建立一套
            "path": "pages/about/about",
            "style": {
                "navigationBarTitleText": "关于"
            }
        }
    ],
    "globalStyle": {//全局的样式
        "navigationBarTextStyle": "black",//导航栏标题颜色
        "navigationBarTitleText": "uni-app", //导航栏标题文字内容
        "navigationBarBackgroundColor": "#F8F8F8",//导航栏背景颜色
        "backgroundColor": "#F8F8F8",//窗口的背景色 微信小程序
        "navigationStyle":"default"//导航栏样式,仅支持 default/custom,开启custom后,所有窗口均无导航栏。
    },
    "tabBar": {
                "color":"#8a8a8a",
                "selectedColor":"#00aa00",
                "borderStyle":"black",
                "backgroundColor":"#ffffff",
                "list": [
                    {
                        "pagePath":"pages/index/index",
                        "text":"首页",
                        "iconPath":"static/image/home.png",
                        "selectedIconPath":"static/image/home_HL.png"
                    },
                    {
                        "pagePath":"pages/about/about",
                        "text":"我的",
                        "iconPath":"static/image/about.png",
                        "selectedIconPath":"static/image/about_HL.png"
                    }
                ]    
             }
}

 

posted @ 2021-02-05 12:09  创客未来  阅读(4963)  评论(0编辑  收藏  举报