Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of basic configuration for Mini Program development

2025-03-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

The knowledge points of this article "the method of basic configuration of Mini Program Development" are not quite understood by most people, so the editor summarizes the following contents for you, with detailed contents and clear steps, which can be used for reference. I hope you can get something after reading this article. Let's take a look at this "method of basic configuration of Mini Program development" article.

If Mini Program is a multi-tab application (there is a tab bar at the bottom or top of the client window to switch pages), you can specify the performance of the tab bar through the tabBar configuration item and the corresponding page to be displayed when tab is switched.

Start the development and basic setup of Mini Program

New project

Note: if there is an APPID, remember to fill it in, but if there is no point-level Mini Program, remember to tick the normal startup template.

Basic configuration

If Mini Program is a multi-tab application (there is a tab bar at the bottom or top of the client window to switch pages), you can specify the performance of the tab bar through the tabBar configuration item and the corresponding page to be displayed when tab is switched.

Tip:

1. When position is set to top, icon will not be displayed

List in 2.tabBar is an array, and you can only configure at least 2 and up to 5 tab,tab to sort in the order of the array.

Example:

-

Example:

Take an array, each of which is a string, to specify which pages the Mini Program consists of. Each item represents the [path + file name] information of the corresponding page, and the first item of the array represents the initial page of Mini Program. When adding or decreasing pages in Mini Program, you need to modify the pages array.

Example:

Property     type      required    description

Pages   String Array   is the path of the     settings page

Window       Object      No     sets the window performance of the default page

TabBar    Object      No     sets the performance of the bottom tab

NetworkTimeout Object      No     sets the network timeout

Debug   Boolean    No     sets whether debug mode is enabled

The app.json file is used to configure WeChat Mini Programs globally, determine the path of the page file, window performance, set network timeout, set multi-tab, and so on.

The following is an app.json that contains all configuration options:

{"pages": ["pages/index/index", "pages/logs/index"], "window": {"navigationBarTitleText": "Demo"}, "tabBar": {"list": [{"pagePath": "pages/index/index", "text": "Home"}, {"pagePath": "pages/logs/logs" "text": "log"}]}, "networkTimeout": {"request": 10000, "downloadFile": 10000}, "debug": true}

List of app.json configuration items

Pages sets the page path

{"pages": [/ / "pages/ page folder name / page .wxml name", "pages/index/index", "pages/logs/logs"]}

Window is used to set the status bar, navigation bar, title and window background color of Mini Program.

"window": {"backgroundTextStyle": "light", / / default: dark, drop-down loading style. Only dark/light "navigationBarBackgroundColor": "# f1f1f1", / / default: # 000000, navigation bar background color, such as "# 000000"navigationBarTitleText": "JD.com", / / navigation bar title text content "navigationBarTextStyle": "black", / / default: white navigation bar title color Only black/white "backgroundColor": "# f1f1f1" is supported, / / default: # ffffff, background color of the window}

TabBar

"tabBar": {"position": "bottom", / / default: bottom, optional values bottom, top "borderStyle": "white", / / default: black, the color of the border on tabbar, only supports black/white "color": "# f10215", / / tab text default color "selectedColor": "# f10215", / / text on tab selected color "backgroundColor": "# ffffff", / / background color of tab / / list of tab For more information, please see list attribute description. There are at least 2 and 5 tab "list": [{"pagePath": "pages/index/index", / / page path. You must first define "text": "home page" in pages, / / button text "iconPath" on / / tab: "images/index.png", / / image path, icon size is limited to 40kb, recommended size is 81px * 81px. This parameter is not valid when postion is top. The path of the network image "selectedIconPath": "images/index_b.png" / / is not supported. The size of icon is limited to 40kb. The recommended size is 81px * 81px, when postion is top. This parameter is invalid}, {"pagePath": "pages/category/category", "text": "category", "iconPath": "images/category.png", "selectedIconPath": "images/category_b.png"}, {"pagePath": "pages/cart/cart", "text": "shopping cart", "iconPath": "images/cart.png" "selectedIconPath": "images/cart_b.png"}, {"pagePath": "pages/user/user", "text": "my", "iconPath": "images/user.png", "selectedIconPath": "images/user_b.png"}]} these are the contents of this article on the basic configuration of Mini Program development. I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report