Skip to main content
Version: Next

Navigator

A link to a page.

Reference

Type

ComponentType<NavigatorProps>
PropertyTypeDefaultRequiredDescription
target"self" | "miniProgram""self"NoSpecifies the target to be redirected from. It is the current Mini Program by default.
urlstringNoThe redirection link in the current Mini Program.
openType"navigate" | "redirect" | "switchTab" | "reLaunch" | "navigateBack" | "exit""navigate"NoThe redirection method.
deltanumberNoThe quantity of layers that are rolled back. It is valid when open-type is 'navigateBack'.
appIdstringNoThe appId of the Mini Program to be opened. It is valid whentarget="miniProgram"
pathstringNoThe path of the page to be opened. It is valid whentarget="miniProgram". If the value is empty, the homepage is opened.
extraDataobjectNoThe 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"NoThe version of the Mini Program to be opened. It is valid when target="miniProgram".
hoverClassstring"navigator-hover"NoThe style type of the button that is tapped. Whenhover-class="none", the tap state is not displayed.
hoverStopPropagationbooleanfalseNoSpecifies whether to block the tapped state from the ancestor node of this node.
hoverStartTimenumber50NoSpecifies the time elapsed after tapping but before the tapped state occurs. It is measured in milliseconds.
hoverStayTimenumber600NoSpecifies the duration when the tapped state retains after stopping tapping. It is measured in milliseconds.
onSuccessBaseEventOrigFunction<any>NoSuccessful redirection to the Mini Program. It is valid when target="miniProgram".
onFailBaseEventOrigFunction<any>NoFailed to redirect to the Mini Program failed. It is valid whentarget="miniProgram".
onCompleteBaseEventOrigFunction<any>NoRedirection to the Mini Program completed. It is valid whentarget="miniProgram".

Property Support

PropertyWeChat Mini-ProgramBaidu Smart-ProgramAlipay Mini-ProgramByteDance Micro-AppH5React 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

ValueDescription
selfCurrent Mini Program
miniProgramOther Mini Programs

openType

Valid values of open-type

ValueDescription
navigateThe feature corresponding to Taro.navigateTo or Taro.navigateToMiniProgram
redirectThe feature corresponding to Taro.redirectTo
switchTabThe feature corresponding to Taro.switchTab
reLaunchThe feature corresponding to Taro.reLaunch
navigateBackThe feature corresponding to Taro.navigateBack
exitExits the Mini Program. It is valid when target="miniProgram".

version

Valid values of version

ValueDescription
developDeveloper version
trialTest version
releaseOfficial 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

APIWeChat Mini-ProgramBaidu Smart-ProgramAlipay Mini-ProgramByteDance Micro-AppH5React Native
Navigator✔️✔️✔️✔️