This API is used via wx.switchTab(Object object).
Attribute | Type | Default value | Required | Description |
url | string | - | Yes | The path to the tabBar page that needs to be redirected (code package path) (must be defined on the page in the tabBar field of app.json). The path cannot carry parameters. |
success | function | - | No | Callback Function of Successful Interface Call |
fail | function | - | No | Callback Function of Successful Interface Call |
complete | function | - | No | Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations) |
// app.json{"tabBar": {"list": [{"pagePath": "index","text": "Homepage"},{"pagePath": "other","text": "Other"}]}}
wx.switchTab({url: '/index'})
This method is used via wx.reLaunch(Object object).
Attribute | Type | Default value | Required | Description |
url | string | - | Yes | The path to a non-tabBar page within the application to which you want to redirect (code package path). This path can be followed by parameters. Parameters are separated from the path by a ? , with parameter keys and values connected by a = , and different parameters separated by a & . For example, 'path?key=value&key2=value2' |
success | function | - | No | Callback Function of Successful Interface Call |
fail | function | - | No | Callback Function of Failing Interface Call |
complete | function | - | No | Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations) |
wx.reLaunch({url: 'test?id=1'})
This API is used via wx.redirectTo(Object object).
Attribute | Type | Default value | Required | Description |
url | string | - | Yes | The path to a page within the application to which you want to redirect (code package path). This path can be followed by parameters. Parameters are separated from the path by a ? , with parameter keys and values connected by a =, and different parameters separated by a & . For example, 'path?key=value&key2=value2' |
success | function | - | No | Callback Function of Successful Interface Call |
fail | function | - | No | Callback Function of Failing Interface Call |
complete | function | - | No | Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations) |
wx.redirectTo({url: 'test?id=1'})
This API is used via wx.navigateTo(Object object).
Attribute | Type | Default value | Required | Description |
url | string | - | Yes | The path to the non-tabBar page within the application to which you want to navigate (code package path). This path can be followed by parameters. Parameters are separated from the path by a ? , parameter keys and values are connected by an equals sign, and different parameters are separated by a & ; for example, 'path?key=value&key2=value2' |
success | function | - | No | Callback Function of Successful Interface Call |
fail | function | - | No | Callback Function of Failing Interface Call |
complete | function | - | No | Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations) |
wx.navigateTo({url: 'test?id=1',})//test.jsPage({onLoad: (option){console.log(option.query)}})
This API is used via wx.navigateBack(Object object).
Attribute | Type | Default value | Required | Description |
delta | number | 1 | No | The number of pages returned. If delta exceeds the number of existing pages, it will return to the home page. |
success | function | - | No | Callback Function of Successful Interface Call |
fail | function | - | No | Callback Function of Failing Interface Call |
complete | function | - | No | Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations) |
// Note: When calling navigateTo for navigation, the page that calls this method will be added to the stack, whereas the redirectTo method will not. See the example code below.// This is page Awx.navigateTo({url: 'B?id=1'})// This is page Bwx.navigateTo({url: 'C?id=1'})// Perform navigateback within page C will return to page A.wx.navigateBack({delta: 2})
This method is used via EventChannel.emit(string eventName, any args).
This method is used via EventChannel.off(string eventName, EventCallback fn).
This method is used via EventChannel.on(string eventName, EventCallback fn).
This method is used via EventChannel.once(string eventName, EventCallback fn)
Was this page helpful?