title: Taro.getCurrentPages()

sidebar_label: getCurrentPages

Gets the current page stack. In the array, the first element is the homepage and the last element is the current page.

Note:

  • Do not modify the page stack as this will lead to routing and page status errors.
  • Do not call getCurrentPages() when App.onLaunch is called since page is not generated.

Reference

Type

  1. () => Page[]

Parameters

Sample Code

  1. Taro.getCurrentPages().length

API Support

API WeChat Mini-Program H5 React Native
Taro.getCurrentPages ✔️ ✔️ ✔️