Home > Web Front-end > Uni-app > body text

How to remove the native navigation bar in uniapp

PHPz
Release: 2023-04-20 13:59:24
Original
3690 people have browsed it

With the advent of the mobile Internet era, more and more companies choose to develop their own mini programs to meet the needs of users. In the development of small programs, uniapp has become a popular technical framework. However, uniapp comes with a native navigation bar by default, which is not very convenient in some scenarios. So, how to remove the native navigation bar in the uniapp application? This article will introduce relevant methods to you.

Step 1: Set the page to full screen

In the process of removing the native navigation bar, the first step is to set the page to full screen. The specific implementation method is as follows:

  1. Find the App.vue file in the root directory of the uniapp project, and add the following code to the file:
Copy after login
  1. In In the above code, we first set the original title bar to be invisible. Then, set the page to full screen by setting the relevant styles of app-page.
  2. Finally, add the following code to the specific components of the page:


Copy after login

Step 2: Use the mescroll-view component

to remove the native navigation At the same time, we also need to retain some functions of the native navigation bar, such as status bar, return button, etc. In uniapp, the mescroll-view component is provided, which can solve this problem very well.

The specific implementation method is as follows:

  1. Introduce the mescroll-uni plug-in in the pages.json file:
{
    "pages": [
        {
            "path": "pages/index/index",
            "style": {
                "navigationBarTitleText": "uni-app",
                "navigationBarBackgroundColor": "#f8f8f8"
            },
            "usingComponents": {
                "mescroll-uni": "/static/mescroll-uni/mescroll-uni"
            }
        }
    ]
}
Copy after login
  1. In the specific components of the page , add the following code:


Copy after login
  1. Finally, add the following code to the App.vue file:
Copy after login

Through the above steps, you can successfully remove uniapp The native navigation bar in the app while retaining functions such as status bar and back button. I hope to be helpful.

The above is the detailed content of How to remove the native navigation bar in uniapp. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!