Skip to main content
Version: 3.x

Taro.navigateBack(option)

Closes the current page and returns to the previous page or multi-level page. The current page stack can be obtained via getCurrentPages to determine the number of layers to be returned.

Reference

Type

(option?: Option) => Promise<CallbackResult>

Parameters

Option

PropertyTypeRequiredDescription
complete(res: CallbackResult) => voidNoThe callback function used when the API call completed (always executed whether the call succeeds or fails)
deltanumberNoNumber of pages returned. The home page is navigated to if delta is greater than the current number of pages.
fail(res: CallbackResult) => voidNoThe callback function for a failed API call
success(res: CallbackResult) => voidNoThe callback function for a successful API call

Sample Code

// Note: When calling navigateTo, the page that calls this method is added to the stack, but the redirectTo method will not. See the sample code below.
// This is Page A
Taro.navigateTo({
url: 'B?id=1'
})
// This is Page B
Taro.navigateTo({
url: 'C?id=1'
})
// Calling navigateBack on Page C will return to Page A
Taro.navigateBack({
delta: 2
})

API Support

APIWeChat Mini-ProgramH5React Native
Taro.navigateBack✔️✔️✔️