# navigator
Start from base library version 1.0.0. Please remaining backward compatible.
Page link.
Using Require Base Library Versions in Mini Programs Plug-ins 2.1.0 Up.
attribute | type | Default value | Required | Introductions | Minimum version |
---|---|---|---|---|---|
target | string | self | no | On which target to jump, default current Mini Program | 2.0.7 |
url | string | no | Jump links within the current Mini Program | 1.0.0 | |
open-type | string | navigate | no | Jump mode | 1.0.0 |
delta | number | 1 | no | when open-type for 'navigateBack' Is valid for the number of levels of fallback | 1.0.0 |
app-id | string | no | whentarget="miniProgram" The Mini Program that you want to open appId | 2.0.7 | |
path | string | no | whentarget="miniProgram" Open the page path, if empty then open the home page | 2.0.7 | |
extra-data | object | no | whentarget="miniProgram" Data that needs to be passed to the target Mini Program, which is available in the App.onLaunch() ,App.onShow() Get this data from.details | 2.0.7 | |
version | string | release | no | whentarget="miniProgram" Version of the Mini Program to be opened | 2.0.7 |
short-link | string | no | whentarget="miniProgram" When this parameter is passed, it may not be passed app-id and path。 Links can be made via [Mini Program menu] ->[Copy link] Get. | 2.18.1 | |
hover-class | string | navigator-hover | no | Specifies the style class at click, whenhover-class="none" There is no click state effect | 1.0.0 |
hover-stop-propagation | boolean | false | no | Specifies whether to prevent this node's ancestor from clicking | 1.5.0 |
hover-start-time | number | 50 | no | How long does it take to click, in milliseconds? | 1.0.0 |
hover-stay-time | number | 600 | no | Click hold time after finger release, in milliseconds | 1.0.0 |
bindsuccess | string | no | whentarget="miniProgram" When valid, jump Mini Program success | 2.0.7 | |
bindfail | string | no | whentarget="miniProgram" The jump Mini Program failed | 2.0.7 | |
bindcomplete | string | no | whentarget="miniProgram" The jump Mini Program is complete | 2.0.7 |
target Legal value
value | Introductions | Minimum version |
---|---|---|
self | Current Mini Program | |
miniProgram | Other Mini Program |
open-type Legal value
value | Introductions | Minimum version |
---|---|---|
navigate | Corresponding wx.navigateTo or wx.navigateToMiniProgram Function | |
redirect | Corresponding wx.redirectTo Function | |
switchTab | Corresponding wx.switchTab Function | |
reLaunch | Corresponding wx.reLaunch Function | 1.1.0 |
navigateBack | Corresponding wx.navigateBack Function | 1.1.0 |
exit | Exit the Mini Program,target="miniProgram" Effective | 2.1.0 |
version Legal value
value | Introductions | Minimum version |
---|---|---|
develop | Development version | |
trial | Experience version | |
release | Official version. This parameter is valid only if the current Mini Program is in development or trial versionIf the current Mini Program is an official version, the open Mini Program must be the official version. |
# Use restrictions
- User confirmation required
from
2.3.0
Version, before jumping to other Mini Programs, will be unified to increase pop-up window, ask whether jump, users can jump other Mini Program after confirmation. If the user clicks cancel, the callbackfail cancel
。 - Each Mini Program can jump to no more than the number of other Mini Program 10 individual
from 2.4.0 Version and the specified date (specific to be determined) start, developers submit a new version of the Mini Program code, such as the use of jump other Mini Program functions, you need to declare in the code configuration to jump the list of Mini Program, limited to no more than 10 Otherwise, it will not pass the audit. The list can be updated when a new version is released and does not support dynamic changes. Configuration method for details Configuration。 When this interface is called, the appId Must be in the configuration list or callback
fail appId "${appId}" is not in navigateToMiniProgramAppIdList
。
# No need to declare the jump list, not limited to the number of jump (public test)
- From April 24, 2020, using jump other Mini Program features will not require the declaration of jump lists in the global configuration, and this interface will no longer verify the jump AppID Whether or not navigateToMiniProgramAppIdList In.
- From April 24, 2020, jump other Mini Programs will no longer be limited by the number, please pay attention to the use of this feature to comply with the operating norms.
# About debugging
- Call this on the developer tool API There is no actual jump to another Mini Program, but the developer tool will verify that the jump was successful.[details]((different#Jump Mini Program Debugging Support))
- Developer tools to support the jump Mini Program handling receive parameters debugging.[details]((different#Jump Mini Program Debugging Support))
# Bug & Tip
tip
:navigator-hover
Default is{background-color: rgba(0, 0, 0, 0.1) opacity: 0.7}
, navigator Child node background color should be transparent
# sample code
.navigator-hover {
color:blue
}
.other-navigator-hover {
color:red
}
<!-- sample.wxml -->
<view class="btn-area">
<navigator url="/page/navigate/navigatetitle=navigate" hover-class="navigator-hover">Jump to a new page</navigator>
<navigator url="../../redirect/redirect/redirecttitle=redirect" open-type="redirect" hover-class="other-navigator-hover">Open on the current page</navigator>
<navigator url="/page/index/index" open-type="switchTab" hover-class="other-navigator-hover">to switch over Tab</navigator>
<navigator target="miniProgram" open-type="navigate" app-id="" path="" extra-data="" version="release">Open the bound Mini Program</navigator>
</view>
<!-- navigator.wxml -->
<view style="text-align:center"> {{title}} </view>
<view> Click on the upper left to return to the previous page </view>
<!-- redirect.wxml -->
<view style="text-align:center"> {{title}} </view>
<view> Click on the top left corner back to the parent page </view>
Page({
onLoad: function(options) {
this.setData({
title: options.title
})
}
})