Global configuration of Applet development, global configuration of Applet
I. app. json
You can use the app. json file to globally configure the applet and determine the path, window performance, network timeout, and multi-tab settings of the page file.
Note that the. json file cannot be annotated; otherwise, an error occurs.
Ii. toolbar tabBar
If our applet is a multi-tab application (the tab bar can be switched at the bottom or top of the client window), we can use the tabBar configuration item to specify the display of the tab bar, and the corresponding page displayed during tab switching.
TabBar is an array. You can configure at least two or five tabs. The tabs are sorted in the order of the array.
App. json
{"Pages": ["pages/index", "pages/coming", "pages/search", "pages/top"], "window": {"navigationBarBackgroundColor": "# 47a86c", "navigationBarTextStyle": "white", "navigationBarTitleText": "applet case", "backgroundColor ": "# fff", "backgroundTextStyle": "dark"}, "tabBar": {"color": "#686868", "selectedColor": "# 47a86c ", "backgroundColor": "# fff", "list": [{"pagePath": "pages/index", "iconPath": "dist/images/popular_icon.png ", "selectedIconPath": "dist/images/popular_active_icon.png", "text": "" },{ "pagePath": "pages/coming", "iconPath ": "dist/images/coming_icon.png", "selectedIconPath": "dist/images/coming_active_icon.png", "text": "waiting for "},{ "pagePath ": "pages/search", "iconPath": "dist/images/search_icon.png", "selectedIconPath": "dist/images/search_active_icon.png", "text ": "Search" },{ "pagePath": "pages/top", "iconPath": "dist/images/top_icon.png", "selectedIconPath ": "dist/images/top_active_icon.png", "text": "koubei"}]}, "networkTimeout": {"request": 10000, "downloadFile": 10000 }, "debug": true}
The icon can be placed at the same level as pages. The file name is customized.
Other attributes in app. json: You can view official documents.
Thank you for reading this article. I hope it will help you. Thank you for your support for this site!