search
HomeWeb Front-enduni-appClose the top bar on the uniapp startup page

In recent years, with the rapid development of mobile Internet, the development of various mobile applications and small programs has become more and more popular. As a modern development framework, Uniapp can develop multiple platforms at the same time and is very popular among developers. However, during the development of Uniapp, sometimes we need to close the top bar of the startup page, and this is not easy to do.

In this article, we will explore how to close the top bar in Uniapp’s startup page. This will help developers better master Uniapp development skills.

1. Uniapp startup page

Before we start talking about how to close the top bar of the Uniapp startup page, we need to first understand the Uniapp startup page.

The Uniapp startup page refers to the welcome interface when the APP or mini program is opened for the first time. Its design is beautiful, simple, and intuitive. The role of the startup page is to help users become better familiar with our application and provide users with a meaningful information interface when the program starts.

In Uniapp, we can set the startup page by setting "appLaunch": true in the manifest.json file, as shown below:

{
  "appLaunch": true,
  "pages": [
    "pages/home/home"
  ]
}

2. Close the top bar of the Uniapp startup page

Sometimes, we want to close the top bar in the Uniapp startup page to make the page more concise and beautiful. However, in actual development, we found that closing the top bar was not that easy.

After some research and attempts, we found that we can close the top bar of the Uniapp startup page through the following two methods:

  1. Set the navigationBarHidden property to true in App.vue

In Uniapp's App.vue file, we can close the top bar by setting the navigationBarHidden property to true. The sample code is as follows:

<template>
  <div>
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  name: 'App',
  data() {
    return {
      navigationBarHidden: true // 隐藏顶部栏
    }
  }
}
</script>

Among them, the default value of the navigationBarHidden property is false. , which displays the top bar. When set to true, the top bar will be hidden.

  1. Set the style of the top bar in the style tag of App.vue

If we want to precisely control the style of the top bar, such as changing the background color or font color, We can set the style of the top bar in the style tag of the App.vue file. The sample code is as follows:

<template>
  <div>
    <router-view></router-view>
  </div>
</template>

<style>
/* 关闭顶部栏 */
.uni-page-head {
  display: none;
}
</style>

In this example, we turn off the top bar by setting the display property of .uni-page-head. The advantage of this method is that it can precisely control the style of the top bar, but the disadvantage is that it requires rewriting the style.

3. Summary

In Uniapp development, the design of the startup page is an important link. Through the method described in this article, closing the top bar on the Uniapp startup page can make our page more concise and beautiful. We can achieve this by setting the navigationBarHidden attribute or setting the display attribute of .uni-page-head in the style.

In short, Uniapp, as a modern development framework, is powerful, flexible and very suitable for the development of mobile applications. In actual development, we need to continuously and in-depth study the related technologies of Uniapp in order to better master the development skills of Uniapp.

The above is the detailed content of Close the top bar on the uniapp startup page. 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
How do you debug issues on different platforms (e.g., mobile, web)?How do you debug issues on different platforms (e.g., mobile, web)?Mar 27, 2025 pm 05:07 PM

The article discusses debugging strategies for mobile and web platforms, highlighting tools like Android Studio, Xcode, and Chrome DevTools, and techniques for consistent results across OS and performance optimization.

What debugging tools are available for UniApp development?What debugging tools are available for UniApp development?Mar 27, 2025 pm 05:05 PM

The article discusses debugging tools and best practices for UniApp development, focusing on tools like HBuilderX, WeChat Developer Tools, and Chrome DevTools.

How do you perform end-to-end testing for UniApp applications?How do you perform end-to-end testing for UniApp applications?Mar 27, 2025 pm 05:04 PM

The article discusses end-to-end testing for UniApp applications across multiple platforms. It covers defining test scenarios, choosing tools like Appium and Cypress, setting up environments, writing and running tests, analyzing results, and integrat

What are the different types of testing that you can perform in a UniApp application?What are the different types of testing that you can perform in a UniApp application?Mar 27, 2025 pm 04:59 PM

The article discusses various testing types for UniApp applications, including unit, integration, functional, UI/UX, performance, cross-platform, and security testing. It also covers ensuring cross-platform compatibility and recommends tools like Jes

What are some common performance anti-patterns in UniApp?What are some common performance anti-patterns in UniApp?Mar 27, 2025 pm 04:58 PM

The article discusses common performance anti-patterns in UniApp development, such as excessive global data use and inefficient data binding, and offers strategies to identify and mitigate these issues for better app performance.

How can you use profiling tools to identify performance bottlenecks in UniApp?How can you use profiling tools to identify performance bottlenecks in UniApp?Mar 27, 2025 pm 04:57 PM

The article discusses using profiling tools to identify and resolve performance bottlenecks in UniApp, focusing on setup, data analysis, and optimization.

How can you optimize network requests in UniApp?How can you optimize network requests in UniApp?Mar 27, 2025 pm 04:52 PM

The article discusses strategies for optimizing network requests in UniApp, focusing on reducing latency, implementing caching, and using monitoring tools to enhance application performance.

How can you optimize images for web performance in UniApp?How can you optimize images for web performance in UniApp?Mar 27, 2025 pm 04:50 PM

The article discusses optimizing images in UniApp for better web performance through compression, responsive design, lazy loading, caching, and using WebP format.

See all articles

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools