Router
#
Routing APIIn a mini-program, default routing features are presented and don't necessitate any further configuration by the developer.
You just need to declare the pages in the configuration of the entrance file, then you can jump to the destination page by utilizing the API provided by the mini-program. For example:
For a detailed description of the API, please refer to the API documentation.
#
Route PassingYou can redirect by appending a query string parameter after all the jumped URLs. For example:
In this case, the passed parameters will be available in the lifecycle method of the target page once the jump is successful. This can be accessed through getCurrentInstance().router.params
. For the above navigation action, in the onShow()
lifecycle of the target page:
#
EventChannelWhen calling navigateTo
, we can use EventChannel
to facilitate communication between the opener page and the opened page. For instance: