Router
#
Routing APIIn mini program, the routing feature comes by default and does not require additional routing configuration by the developer.
We just need to specify the pages in the config configuration of the entry file, and then we can jump to the destination page in our code through the API provided by mini program, for example
For a detailed API description, please refer API
#
Routing PassingWe can redirect by adding a query string parameter after all jumped URLs, for example
In this case, the incoming parameters will be available in the lifecycle method of the target page of the successful jump via getCurrentInstance().router.params, e.g. for the above jump, in the componentWillMount (or created in Vue) lifecycle of the target page:
#
EventChannelWe can use EventChannel to communicate between opener page and opened page when we call navigateTo
, for example