title: Navigator

sidebar_label: Navigator

A link to a page.

Reference

Type

  1. ComponentType<NavigatorProps>

NavigatorProps

Property Type Default Required Description
target "self" | "miniProgram" "self" No Specifies the target to be redirected from. It is the current Mini Program by default.
url string No The redirection link in the current Mini Program.
openType "navigate" | "redirect" | "switchTab" | "reLaunch" | "navigateBack" | "exit" "navigate" No The redirection method.
delta number No The quantity of layers that are rolled back. It is valid when open-type is ‘navigateBack’.
appId string No The appId of the Mini Program to be opened. It is valid whentarget="miniProgram"
path string No The path of the page to be opened. It is valid whentarget="miniProgram". If the value is empty, the homepage is opened.
extraData object No The data to be passed to the target Mini Program. It is valid when target="miniProgram". The target Mini Program can obtain this data from App.onLaunch() and App.onShow().
version "develop" | "trial" | "release" No The version of the Mini Program to be opened. It is valid when target="miniProgram".
hoverClass string "navigator-hover" No The style type of the button that is tapped. Whenhover-class="none", the tap state is not displayed.
hoverStopPropagation boolean false No Specifies whether to block the tapped state from the ancestor node of this node.
hoverStartTime number 50 No Specifies the time elapsed after tapping but before the tapped state occurs. It is measured in milliseconds.
hoverStayTime number 600 No Specifies the duration when the tapped state retains after stopping tapping. It is measured in milliseconds.
onSuccess BaseEventOrigFunction<any> No Successful redirection to the Mini Program. It is valid when target="miniProgram".
onFail BaseEventOrigFunction<any> No Failed to redirect to the Mini Program failed. It is valid whentarget="miniProgram".
onComplete BaseEventOrigFunction<any> No Redirection to the Mini Program completed. It is valid whentarget="miniProgram".

Property Support

Property WeChat Mini-Program Baidu Smart-Program Alipay Mini-Program ByteDance Micro-App H5 React Native
NavigatorProps.target ✔️ ✔️
NavigatorProps.url ✔️ ✔️ ✔️ ✔️
NavigatorProps.openType ✔️ ✔️ ✔️ ✔️
NavigatorProps.delta ✔️ ✔️ ✔️
NavigatorProps.appId ✔️ ✔️
NavigatorProps.path ✔️ ✔️
NavigatorProps.extraData ✔️ ✔️
NavigatorProps.version ✔️ ✔️
NavigatorProps.hoverClass ✔️ ✔️ ✔️ ✔️
NavigatorProps.hoverStopPropagation ✔️ ✔️ ✔️
NavigatorProps.hoverStartTime ✔️ ✔️ ✔️ ✔️
NavigatorProps.hoverStayTime ✔️ ✔️ ✔️ ✔️
NavigatorProps.onSuccess ✔️ ✔️
NavigatorProps.onFail ✔️ ✔️
NavigatorProps.onComplete ✔️ ✔️

target

Valid values of target

Value Description
self Current Mini Program
miniProgram Other Mini Programs

openType

Valid values of open-type

Value Description
navigate The feature corresponding to Taro.navigateTo or Taro.navigateToMiniProgram
redirect The feature corresponding to Taro.redirectTo
switchTab The feature corresponding to Taro.switchTab
reLaunch The feature corresponding to Taro.reLaunch
navigateBack The feature corresponding to Taro.navigateBack
exit Exits the Mini Program. It is valid when target="miniProgram".

version

Valid values of version

Value Description
develop Developer version
trial Test version
release Official version. This parameter is valid only when the current Mini Program is in the developer version or the test version. If the current Mini Program is in the official version, the opened Mini Program is definitely in the official version.

API Support

API WeChat Mini-Program Baidu Smart-Program Alipay Mini-Program ByteDance Micro-App H5 React Native
Navigator ✔️ ✔️ ✔️ ✔️