Navigate Between Pages
Register the destination Page in app.json, then use wx.navigateTo() to keep the current page and open the destination. Query parameters are passed to the target.
Complete the Example
Register the destination Page in app.json, then use wx.navigateTo() to keep the current page and open the destination. Query parameters are passed to the target.
wx.navigateTo({
url: '/pages/detail/index?id=42',
success() {
console.log('Detail page opened');
},
fail(error) {
console.error('Navigation failed', error);
}
});
See Routing APIs for back navigation and redirects.