Keep the current page, jump to a page in the application, and use it uni.navigateBack
to return to the original page
//在起始页面跳转到test.vue页面并传递参数
uni.navigateTo({
url: 'test?id=1&name="lisa"'
});
uni.redirectTo(OBJECT)
Close the current page and jump to a page in the app.
uni.redirectTo({
url: 'test?name="lisa"'
});
uni.reLaunch(OBJECT)
Close all pages and open to a page within the app.
uni.reLaunch({
url: 'test?id=1'
});
How to hide the upper left button
The life cycle will hide the button in the upper left corner (must be uni.reLaunch method)
uni.hideHomeButton();
onLoad() {
uni.hideHomeButton();
},
uni.switchTab(OBJECT)
Jump to the tabBar page and close all other non-tabBar pages
uni.switchTab({
url: '/pages/index/index'
});
uni.navigateBack(OBJECT)
Close the current page and return to the previous page or multi-level pages. You can determine how many layers need to be returned by getCurrentPages()
obtaining the current page stack
// 注意:调用 navigateTo 跳转时,调用该方法的页面会被加入堆栈,而 redirectTo 方法则不会。见下方示例代码
// 此处是A页面
uni.navigateTo({
url: 'B?id=1'
});
// 此处是B页面
uni.navigateTo({
url: 'C?id=1'
});
// 在C页面内 navigateBack,将返回A页面
uni.navigateBack({
delta: 2
});
uni.preloadPage(OBJECT)
Preloading pages is a performance optimization technology. Preloaded pages open faster
uni.preloadPage({url: "/pages/test/test"});
For more information, please refer to the official website: uni.navigateTo(OBJECT) | uni-app official website