Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@uni/navigate

raxjs2.7kBSD-3-Clause1.0.11TypeScript support: included

npm

readme

navigate

npm

Route navigation capability implementation.

Support

browser weex miniApp wechatMiniprogram bytedanceMicroApp baiduSmartProgram kuaiShouMiniProgram

Install

$ npm install @uni/navigate --save

Usage

import navigate from '@uni/navigate';

// How to use it in quickapp
// import chooseImage from '@uni/navigate/lib/quickapp;

navigate.push({
  url: 'https://www.taobao.com/'
}).then(() => {
});

navigate.back().then(() => {
});

navigate.go({
  step: -1
}).then(() => {
});

navigate.replace({
  url: 'https://www.taobao.com/'
}).then(() => {
});

navigate.reLaunch({
  url: 'https://www.taobao.com/'
}).then(() => {
});

Methods

push(options)

Arguments

Property Type Description required Default
options object Push function arguments true -
options.url string The page URL. true -
options.success Function The callback function for a successful API call false -
options.fail Function The callback function for a failed API call false -
options.complete Function The callback function used when the API call completed (always executed whether the call succeeds or fails) -

back(options)

Arguments

Property Type Description required Default
options object Pop function arguments false -
options.success Function The callback function for a successful API call false -
options.fail Function The callback function for a failed API call false -
options.complete Function The callback function used when the API call completed (always executed whether the call succeeds or fails) -

go(options)

Arguments

Property Type Description required Default
options object Go function arguments true -
options.step number The number of forward steps is positive and only supports the web, and the number of backward steps is negative. true -
options.success Function The callback function for a successful API call false -
options.fail Function The callback function for a failed API call false -
options.complete Function The callback function used when the API call completed (always executed whether the call succeeds or fails) -

replace(options)

Arguments

Property Type Description required Default
options object Go function arguments true -
options.url number The page URL. true -
options.success Function The callback function for a successful API call false -
options.fail Function The callback function for a failed API call false -
options.complete Function The callback function used when the API call completed (always executed whether the call succeeds or fails) -

reLaunch(options)

Arguments

Property Type Description required Default
options object Go function arguments true -
options.url number The page URL. true -
options.success Function The callback function for a successful API call false -
options.fail Function The callback function for a failed API call false -
options.complete Function The callback function used when the API call completed (always executed whether the call succeeds or fails) -

switchTab(options)

Does not support web

Arguments

Property Type Description required Default
options object Function options Yes -
options.url string Page url Yes -
options.success Function Callback on success No -
options.fail Function Callback on fail No -
options.complete Function Callback on complete No -