Home Web Front-end uni-app uniapp removes startup page

uniapp removes startup page

May 22, 2023 am 10:16 AM

With the development of the mobile application market, users are paying more and more attention to the experience of using mobile applications. The startup page, as one of the entrances to the application, also needs to be optimized as much as possible to reduce loading time and improve user experience. For applications developed using uniapp, it is also possible to remove the startup page. This article will introduce how to remove the startup page in uniapp.

1. What is the uniapp startup page?

Before introducing how to remove the uniapp startup page, you first need to understand what the uniapp startup page is. The uniapp startup page refers to an interface with the application icon and name that appears on the mobile phone interface when the application is opened. Generally speaking, there are two situations:

  1. Custom startup page
    In uniapp, we can customize the style and content of the startup page, such as setting a background image, adding our own LOGO, etc.
  2. Default startup page
    When we do not set a custom startup page, the default uniapp startup page will be automatically loaded. This startup page is a code developed by the uniapp technical team. It is characterized by simplicity and speed. , easy to use.

2. Why should we remove the uniapp startup page

Although the startup page can improve the quality and user experience of the application, in some cases, we also need to remove the startup page. The following are Some typical examples:

  1. Speed ​​up application startup speed
    Although the startup page is a way to improve the quality of applications, because it needs to load HTML, CSS, JS and other files, some applications The startup speed may be affected by the startup page. In this case, you need to consider removing the startup page to speed up the application startup speed.
  2. Save user traffic
    Loading the startup page requires user traffic. For some applications that use billing strategies, you can consider removing the startup page to save user traffic.
  3. Reduce application size
    The startup page needs to load HTML, CSS, JS and other files. Although these files are small, when the application size is large, removing the startup page can reduce the size of the application and improve user experience. Download and installation experience.

3. How to remove the uniapp startup page

If you decide to remove the uniapp startup page, what should you do? Two implementation methods are introduced below, as follows:

  1. Method 1: Modify the uni-app framework source code

On the Android platform, we can modify uni- app framework source code to remove the startup page. The specific steps are as follows:

  1. Open the vue.config.js file in the project root directory and modify it as follows:
module. exports = {
  // ...
  configureWebpack: {
    plugins: [
      // 去掉Uni-app默认的启动页
      new RemoveWebpackPlugin([/^/?__uni__default/])
    ]
  }
}
Copy after login
  1. Run npm install in the project root directory @intervolga/optimize-cssnano-plugin, install the cssnano plug-in.
  2. Just remove the definition of "activity-alias" in the manifest.xml file of the android code.
  3. Method 2: By calling the API encapsulated by uni-app

On the iOS platform, we can remove the startup page by calling the API encapsulated by uni-app:

  1. When calling the launchWebview method of the plus.navigator class, set splash: 'none'.
plus.navigator.launchWebview(
  "",
  "com.dcloud.uniapp",
  {},
  {
    "uni-app": true,
    splash: 'none',
  }, // 启动参数为界面id
  (e) => {
    // 执行你想执行的方法
  },
  (e) => {
    // 错误处理
  }
);
Copy after login

Through the above two methods, you can easily remove the startup page of uniapp.

4. Summary

The startup page is an important part of the application, which can improve the quality and user experience of the application. However, there are also some situations where the startup page needs to be removed. This article introduces how to remove the startup page from uniapp. There are two implementation methods, I hope it will be helpful to you. If you have questions about other issues with uniapp, you can go to the uniapp official website or the community for help.

The above is the detailed content of uniapp removes startup page. For more information, please follow other related articles on the PHP Chinese website!

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

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)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How do I handle local storage in uni-app? How do I handle local storage in uni-app? Mar 11, 2025 pm 07:12 PM

This article details uni-app's local storage APIs (uni.setStorageSync(), uni.getStorageSync(), and their async counterparts), emphasizing best practices like using descriptive keys, limiting data size, and handling JSON parsing. It stresses that lo

How to rename UniApp download files How to rename UniApp download files Mar 04, 2025 pm 03:43 PM

This article details workarounds for renaming downloaded files in UniApp, lacking direct API support. Android/iOS require native plugins for post-download renaming, while H5 solutions are limited to suggesting filenames. The process involves tempor

How to handle file encoding with UniApp download How to handle file encoding with UniApp download Mar 04, 2025 pm 03:32 PM

This article addresses file encoding issues in UniApp downloads. It emphasizes the importance of server-side Content-Type headers and using JavaScript's TextDecoder for client-side decoding based on these headers. Solutions for common encoding prob

How do I make API requests and handle data in uni-app? How do I make API requests and handle data in uni-app? Mar 11, 2025 pm 07:09 PM

This article details making and securing API requests within uni-app using uni.request or Axios. It covers handling JSON responses, best security practices (HTTPS, authentication, input validation), troubleshooting failures (network issues, CORS, s

How do I use uni-app's geolocation APIs? How do I use uni-app's geolocation APIs? Mar 11, 2025 pm 07:14 PM

This article details uni-app's geolocation APIs, focusing on uni.getLocation(). It addresses common pitfalls like incorrect coordinate systems (gcj02 vs. wgs84) and permission issues. Improving location accuracy via averaging readings and handling

How do I manage state in uni-app using Vuex or Pinia? How do I manage state in uni-app using Vuex or Pinia? Mar 11, 2025 pm 07:08 PM

This article compares Vuex and Pinia for state management in uni-app. It details their features, implementation, and best practices, highlighting Pinia's simplicity versus Vuex's structure. The choice depends on project complexity, with Pinia suita

How do I use uni-app's social sharing APIs? How do I use uni-app's social sharing APIs? Mar 13, 2025 pm 06:30 PM

The article details how to integrate social sharing into uni-app projects using uni.share API, covering setup, configuration, and testing across platforms like WeChat and Weibo.

How do I use uni-app's easycom feature for automatic component registration? How do I use uni-app's easycom feature for automatic component registration? Mar 11, 2025 pm 07:11 PM

This article explains uni-app's easycom feature, automating component registration. It details configuration, including autoscan and custom component mapping, highlighting benefits like reduced boilerplate, improved speed, and enhanced readability.

See all articles