---
title: getCurrentPages
---

## getCurrentPages(): PageObject[]

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

**Things to note**

- **Do not try to modify the page stack. Otherwise, the route and page status might not work properly.**
- When `App.onLaunch` is executed, do not call `getCurrentPages()`, because `page` is not generated.

## Example

```js
// page/index.js
Page({
  onLoad() {
    const pageInsts = getCurrentPages();
    const currentPagePath = pageInsts[pageInsts.length - 1].route;
    console.log('currentPagePath ===> ', currentPagePath);
  },
});
```
