How to jump to the page in uni-app
Jump method: 1. Use "uni.navigateTo(OBJECT)"; 2. Use "uni.redirectTo(OBJECT)"; 3. Use "uni.reLaunch(OBJECT)"; 4. Use " uni.switchTab(OBJECT)" etc.
The operating environment of this tutorial: windows7 system, uni-app version 2.5.1, DELL G3 computer.
uni-app Page jump is mainly completed by the following 5 methods. They are as follows:
(1)uni.navigateTo(OBJECT) Keep the current page and jump to a page in the application
(2)uni.redirectTo(OBJECT) Close the current page, Jump to a page in the application
(3)uni.reLaunch(OBJECT) Close all pages and open a page in the application
(4)uni.switchTab(OBJECT) Jump to the tabBar page , and close all other non-tabBar pages
(5)uni.navigateBack(OBJECT) Close the current page and return to the previous page or multi-level page
uni.navigateTo(OBJECT)
Keep the current page, jump to a page in the application, and use uni.navigateBack to return to the original page. OBJECT parameter description: Parameter type is required. Description: urlString is the path to the non-tabBar page in the application that needs to be jumped. Parameters can be included after the path. Parameters and paths are separated by ?, parameter keys and parameter values are connected by =, and different parameters are separated by &;
uni.navigateTo({ url: 'test?id=1&name=uniapp' }); export default { onLoad: function (option) { console.log(option.id); console.log(option.name); } }
uni.redirectTo(OBJECT)
Close Current page, jump to a page within the application. OBJECT Parameter Description Parameter Type Required Description urlString is the path to the non-tabBar page in the application that needs to be jumped. Parameters can be included after the path. Use ? to separate parameters and paths, connect parameter keys and parameter values with =, and separate different parameters with &;
uni.redirectTo({ url: 'test?id=1' // 传递参数 id,值为1 });
uni.reLaunch(OBJECT)
Close All pages, open to a page within the application. OBJECT parameter description: Parameter type is required. Description urlString is the path to the page within the application that needs to be jumped. Parameters can be included after the path. Parameters and paths are separated by ?, parameter keys and parameter values are connected by =, and different parameters are separated by &;
uni.reLaunch({ url: 'test?id=1' }); export default { onLoad: function (option) { console.log(option.query); } }
uni.switchTab(OBJECT)
Jump Go to the tabBar page and close all other non-tabBar pages. OBJECT parameter description: Parameter type is required. Description: urlString is the path to the tabBar page that needs to be jumped (the page needs to be defined in the tabBar field of app.json). Parameters
pages.json{ "tabBar": { "list": [ { "pagePath": "index", "text": "首页" },{ "pagePath": "other", "text": "其他" }] } } other.vueuni.switchTab({ url: 'index' });
uni are not allowed after the path. navigateBack(OBJECT)
Close the current page and return to the previous page or multi-level page. You can get the current page stack through getCurrentPages() and decide how many levels to return. OBJECT parameter description: Parameter type is required. Description deltaNumber1 The number of pages returned. If delta is greater than the number of existing pages, return to the homepage.
uni.navigateTo({ url: 'B?id=1' }); uni.navigateTo({ url: 'C?id=1' }); uni.navigateBack({ delta: 2 });
[Related recommendations: "uniapp tutorial"]
The above is the detailed content of How to jump to the page in uni-app. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Detailed explanation of PHP page jump functions: Page jump techniques for header, location, redirect and other functions, which require specific code examples. Introduction: When developing a Web website or application, jumping between pages is an essential function. PHP provides a variety of ways to implement page jumps, including header functions, location functions, and jump functions provided by some third-party libraries, such as redirect. This article will introduce in detail how to use these functions

How to develop uni-app in VSCode? The following article will share with you a tutorial on developing uni-app in VSCode. This may be the best and most detailed tutorial. Come and take a look!

How to use uniapp to develop a simple map navigation? This article will provide you with an idea for making a simple map. I hope it will be helpful to you!

Title: Using uniapp to achieve page jump animation effect In recent years, the user interface design of mobile applications has become one of the important factors in attracting users. Page jump animation effects play an important role in improving user experience and visualization effects. This article will introduce how to use uniapp to achieve page jump animation effects, and provide specific code examples. uniapp is a cross-platform application development framework developed based on Vue.js. It can compile and generate applications for multiple platforms such as mini programs, H5, and App through a set of codes.

How to use uniapp to develop a snake game? The following article will take you step by step to implement the Snake game in uniapp. I hope it will be helpful to you!

uni-app interface, global method encapsulation 1. Create an api file in the root directory, create api.js, baseUrl.js and http.js files in the api folder 2.baseUrl.js file code exportdefault"https://XXXX .test03.qcw800.com/api/"3.http.js file code exportfunctionhttps(opts,data){lethttpDefaultOpts={url:opts.url,data:data,method:opts.method

How to use routing to implement page jump in Vue? With the continuous development of front-end development technology, Vue.js has become one of the most popular front-end frameworks. In Vue development, page jump is an essential part. Vue provides VueRouter to manage application routing, and seamless switching between pages can be achieved through routing. This article will introduce how to use routing to implement page jumps in Vue, with code examples. First, install the vue-router plugin in the Vue project.

Title: PHP code example: How to use POST to pass parameters and implement page jumps In web development, it often involves the need to pass parameters through POST and process them on the server side to implement page jumps. PHP, as a popular server-side scripting language, provides a wealth of functions and syntax to achieve this purpose. The following will introduce how to use PHP to implement this function through a practical example. First, we need to prepare two pages, one to receive POST requests and process parameters
