当前位置:网站首页>Implementation of navigation bar at the bottom of applet

Implementation of navigation bar at the bottom of applet

2022-07-07 08:29:00 I eat slowly

1、 The navigation bar at the bottom of the applet is the thing at the bottom

 Insert picture description here

2、 This needs to be app.json Set at “tabBar”

Examples are as follows :

{
  "pages": [
    "pages/index/index",
    "pages/pages1/pages1",
    "pages/pages2/pages2"
  ],
  "window": {
    "backgroundTextStyle": "light",
    "navigationBarBackgroundColor": "#ffffff",
    "navigationBarTitleText": " Applet name ",
    "navigationBarTextStyle": "black",
    "backgroundColor": "#EA0000"
  },
  "sitemapLocation": "sitemap.json",
  "tabBar": {
    "color": "#666666",
    "selectedColor": "#f10b2e",
    "list": [
      {
        "pagePath": "pages/pages1/pages1",
        "text": " page 1",
        "iconPath": "*****",// Icon when not selected 
        "selectedIconPath": "*****"// The selected icon 
      },
      {
        "pagePath": "pages/pages2/pages2",
        "text": " page 2",
        "iconPath": "*****",// Icon when not selected 
        "selectedIconPath": "*****"// The selected icon 
      }
    ]
  }
}

3、 example :

"tabBar": {
		"color": "#000000",
		"selectedColor": "#FF6900",
		"borderStyle": "black",
		"list": [
			// 	{
			// 	"iconPath": "/static/tabbar/index.png",
			// 	"selectedIconPath": "/static/tabbar/index.png",
			// 	"pagePath": "pages/index/index",
			// 	"text": " home page "
			// }, 
			{
				"iconPath": "/static/tabbar/workbench.png",
				"selectedIconPath": "/static/tabbar/work.png",
				"pagePath": "pages/workbench/work",
				"text": " The workbench "
			},
			// {
			// 	"iconPath": "/static/tabbar/msg.png",
			// 	"selectedIconPath": "/static/tabbar/msg.png",
			// 	"pagePath": "pages/message/mes",
			// 	"text": " news "
			// }, 
			{
				"iconPath": "/static/tabbar/my.png",
				"selectedIconPath": "/static/tabbar/my.png",
				"pagePath": "pages/my/my",
				"text": " my "
			}
		]
	},

4、 It should be noted that :

Other pages should jump to tabBar page , Need to use wx.switchTab, Examples are as follows :

wx.switchTab({
        url: '../pages1/pages1'
      })
原网站

版权声明
本文为[I eat slowly]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202130640266670.html