This topic describes the JavaScript APIs of Navigation. You can refer to this topic when you create HTML5 apps or Miniapps, includes to close the current page and open a new Miniapp page.
WVNavigator.pop
Closes the current page.
Input parameters
Custom: If the input parameters are empty, the current page is closed in the default mode. If you want to implement the
NavigatorAdapterAPI by using custom methods, you must specify the input parameters.
Callback parameters
Parameters for a success callback:
No callback parameters exist.
Parameters for a failure callback:
[
string]msg: the error message.
window.WindVane.call('WVNavigator', 'pop', null, function(e) {
}, function(e) {
alert('failure: ' + JSON.stringify(e));
});WVNavigator.push
Opens a new page.
Input parameters
If you want to implement the NavigatorAdapter API by using custom methods, you must specify the input parameters.
If you do not want to implement the NavigatorAdapter API by using custom methods, you must specify the following input parameter.
[
string]url: the URL of the Miniapp page that the user wants to open.
Callback parameters
Parameters for a success callback:
No callback parameters exist.
Parameters for a failure callback:
[
string]msg: the error message.
var params = {
url: 'xxxx'
};
window.WindVane.call('WVNavigator', 'push', params, function(e) {
}, function(e) {
alert('failure: ' + JSON.stringify(e));
});wv.navigateToMiniapp
Navigate from the current mini program to another mini program.
Input parameters
[
string] appId: Miniapp id.[
string] path: which page to navigate, if navigate to the index page, then this param can be empty.[
object] extraData: this object will parse as the query after the navigate path, if the navigate page doesn't need the query, this param can be empty.
Callback parameters
Parameters for a success callback:
No callback parameters exist.
Parameters for a failure callback:
[
string] msg: the error message.
window.WindVane.call(
"wv",
"navigateToMiniapp",
{
// Miniapp id
appId: "2123xxxxxx",
// which page to navigate, if navigate to the index page, then this param can be empty
path: "/product/list",
// this object will parse as the query after the navigate path, if the navigate page doesn't need the query, this param can be empty
extraData: {
source: "APP01"
}
},
function () {
console.log('open Miniapp successfully');
},
function (msg) {
console.log('open Miniapp error', msg);
}
);