当前位置:网站首页>uniapp中设置tabBar及其窗口标题

uniapp中设置tabBar及其窗口标题

2022-08-11 05:17:00 肖肖冲鸭

在微信小程序中,我们设置tabBar是在全局的pages.json中设置,窗口标题是在每个页面的单独的pages.json中设置
但是在uniapp找那个与微信小程序有所不同,它每个页面没有单独的pages.json文件,我们应该在全局的pages.json中每个页面的路径下的style标签下设置样式

{
    
    "globalStyle" : {
    
        "navigationBarTextStyle" : "white",
        "navigationBarTitleText" : "仿网易商城",
        "navigationBarBackgroundColor" : "#BB2C08"
    },
    "uniIdRouter" : {
    },
    "pages" : [
        {
    
            "path" : "pages/index/index",
            "style" : {
    
                "enablePullDownRefresh" : false
            }
        }
        ,{
    
            "path" : "pages/category/category",
            "style" :                                                                                    
            {
    
                "navigationBarTitleText": "分类",
                "enablePullDownRefresh": false
            }
            
        }
        ,{
    
            "path" : "pages/cart/cart",
            "style" :                                                                                    
            {
    
                "navigationBarTitleText": "购物车",
                "enablePullDownRefresh": false
            }
            
        }
        ,{
    
            "path" : "pages/personal/personal",
            "style" :                                                                                    
            {
    
                "navigationBarTitleText": "个人中心",
                "enablePullDownRefresh": false
            }
            
        }
    ],
		"tabBar": {
    
					"color": "#555",
					"selectedColor": "#D43C33",
					"list": [
						{
    
							"pagePath": "pages/index/index",
							"text": "首页",
							"iconPath": "/static/images/tabBar/tab-home.png",
							"selectedIconPath": "/static/images/tabBar/tab-home-current.png"
						},
						{
    
							"pagePath": "pages/category/category",
							"text": "分类",
							"iconPath": "/static/images/tabBar/tab-cate.png",
							"selectedIconPath": "/static/images/tabBar/tab-cate-current.png"
						},
						{
    
							"pagePath": "pages/cart/cart",
							"text": "购物车",
							"iconPath": "/static/images/tabBar/tab-cart.png",
							"selectedIconPath": "/static/images/tabBar/tab-cart-current.png"
						},
						{
    
							"pagePath": "pages/personal/personal",
							"text": "个人中心",
							"iconPath":"/static/images/tabBar/tab-my.png",
							"selectedIconPath": "/static/images/tabBar/tab-my-current.png"
						}
					]
		}
}

在这里插入图片描述
在这里插入图片描述

原网站

版权声明
本文为[肖肖冲鸭]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_48952990/article/details/125978045