diff --git a/pages/API/get-current-pages/get-current-pages.test.js b/pages/API/get-current-pages/get-current-pages.test.js
index f380eecaaa3f82b54f79e79941bf8a33be355808..7a90aa7d963c1f188917f61e05550e3254298156 100644
--- a/pages/API/get-current-pages/get-current-pages.test.js
+++ b/pages/API/get-current-pages/get-current-pages.test.js
@@ -1,11 +1,18 @@
const PAGE_PATH = '/pages/API/get-current-pages/get-current-pages'
describe('getCurrentPages', () => {
+ let page
it('getCurrentPages', async () => {
- const page = await program.navigateTo(PAGE_PATH)
+ page = await program.navigateTo(PAGE_PATH)
await page.waitFor(1000)
- await page.callMethod('getCurrentPages')
+ await page.callMethod('_getCurrentPages')
const data = await page.data()
expect(data.checked).toBe(true)
})
+ it('hideAndShow', async () => {
+ await page.callMethod('hideAndShow')
+ await page.waitFor(1000)
+ const data = await page.data()
+ expect(data.showTimes).toBe(2)
+ })
})
diff --git a/pages/API/get-current-pages/get-current-pages.uvue b/pages/API/get-current-pages/get-current-pages.uvue
index 509b20b3574bee8a2a3fe3a8a7375db373cb2209..a921881db07bacae65ea60aea1a4fc8500199ed5 100644
--- a/pages/API/get-current-pages/get-current-pages.uvue
+++ b/pages/API/get-current-pages/get-current-pages.uvue
@@ -1,37 +1,58 @@
-
-
-
- {{result}}
-
+
+
+
+
+
+ 当前页面栈中 {{pages.length}} 个页面,列表如下:
+
+ index: {{ index }}, route: {{ page.route }}
+
+
+
\ No newline at end of file
+ hideAndShow() {
+ const pages = getCurrentPages()
+ const currentPage = pages[pages.length - 1]
+ const currentPageInstance = currentPage.$getAppPage()
+ if (currentPageInstance != null) {
+ currentPageInstance.hide(new Map())
+ currentPageInstance.show(new Map())
+ }
+ }
+ },
+}
+