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!

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.

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

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

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

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.

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

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

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


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

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version
Visual web development tools

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

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools