Uniapp navigateTo Guide: Page Navigation
In uni-app, navigateTo is the method used for page navigation. Its usage is as follows:
uni.navigateTo({
url: 'path/to/page', // 跳转的页面路径
success: function() {
// 跳转成功的回调函数
},
fail: function() {
// 跳转失败的回调函数
},
complete: function() {
// 跳转完成的回调函数(无论成功与否)
}
})
The navigateTo method is used to transition from the current page to another page within the app. After transitioning, you can return to the original page by using the back button. The path to the page being navigated to must be a relative path and start with a /.
Successful callback functions and failed callback functions can be handled according to the actual situation, such as displaying prompt messages or performing other operations. The completed callback function will be called after the redirection is completed.
It is important to note that the number of pages navigated to using the navigateTo method cannot exceed 5. If more than 5 pages are opened, the earliest opened page will be automatically closed. If you want to navigate to a page that is not the current one, consider using the redirectTo method.