search
HomeWeChat AppletMini Program DevelopmentWeChat Mini Program Example: Implementation Method of Customizing Navigation Bar

The content of this article is about WeChat applet examples: the implementation method of custom navigation bar, which has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

In the WeChat applet, the color of the navigation bar and some attributes of the copy can be set in the window in app.json, or in a single page. If it is a json file of a certain page For the configuration inside, you need to remove the window. For example, configure in app.json:

{
    "window":{
       "backgroundTextStyle":"light",
       "navigationBarBackgroundColor": "#fff",
       "navigationBarTitleText": "WeChat",
       "navigationBarTextStyle":"black",
       "navigationStyle": "custom"
     } }

Configure in the json file of a certain page:

{
  "backgroundTextStyle": "light",
  "navigationBarBackgroundColor": "#405f80",
  "navigationBarTitleText": "文与字",
  "navigationBarTextStyle": "white"}

For details, please refer to the official documentation: https://developers. weixin.qq.com/miniprogram/dev/framework/config.html

But sometimes the navigation bar required by the business is quite special, and the navigation bar provided by the mini program cannot meet the needs. In this case, it can only be customized. .

Let’s talk about the steps to customize the navigation bar first:

  • Add "navigationStyle": "custom" attribute to the window in app.json (the default attribute is "navigationStyle": "default"), then the default navigation bar of the mini program will disappear, as shown in the figure:
    WeChat Mini Program Example: Implementation Method of Customizing Navigation Bar

  • Then follow your own You need to add your own navigation bar to each page.

#Note: navigationStyle only takes effect in app.json. After custom is turned on, lower version clients need to be compatible. Switching the developer tool base library version to 1.7.0 (does not represent the lowest version, only for debugging) can easily switch to the old vision.
That is to say, this property can only be configured in app.json , if you want to customize the navigation bar in a single page, it is not possible. You must customize the navigation bar for all pages. Personally, I think this is quite confusing. Maybe the mini program will be optimized in the future.

Related recommendations:

Mini program example: Implementation code for paging data loading in mini program

WeChat mini program example: click event and long press event Code implementation

How to clear the default styles of buttons and scroll bars in mini programs (code)

The above is the detailed content of WeChat Mini Program Example: Implementation Method of Customizing Navigation Bar. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.