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()whenApp.onLaunchis called sincepageis not generated.
Type
() => Page[]
Parameters
Sample Code
Taro.getCurrentPages().length
API Support
| API | WeChat Mini-Program | H5 | React Native |
|---|---|---|---|
| Taro.getCurrentPages | ✔️ | ✔️ | ✔️ |