Taro.reLaunch(option)
Closes all pages and opens a page in the app.
Type
(option: Option) => Promise<CallbackResult>
Parameters
Option
Property | Type | Required | Description |
---|---|---|---|
url | string | Yes | Path to a page to be navigated to in the app. Parameters can be appended after the path. You can use "?" to separate the path from parameters, "=" to connect a parameter key and a parameter value, and "&" to separate different parameters. For example, 'path?key=value&key2=value2'. |
complete | (res: CallbackResult) => void | No | The callback function used when the API call completed (always executed whether the call succeeds or fails) |
fail | (res: CallbackResult) => void | No | The callback function for a failed API call |
success | (res: CallbackResult) => void | No | The callback function for a successful API call |
Sample Code
Taro.reLaunch({
url: 'test?id=1'
})
API Support
API | WeChat Mini-Program | H5 | React Native |
---|---|---|---|
Taro.reLaunch | ✔️ | ✔️ | ✔️ |