Skip to main content
Version: Next

Taro.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

() => Page[]

Parameters

Sample Code

Taro.getCurrentPages().length

API Support

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