提交 cab95603 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

test: remove page hide and show

上级 18126b9d
......@@ -13,10 +13,4 @@ describe('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)
})
})
......@@ -3,7 +3,6 @@
<page-head title="getCurrentPages"></page-head>
<view class="uni-padding-wrap">
<button @click="_getCurrentPages">getCurrentPages</button>
<button class="uni-common-mt" @click="hideAndShow">页面隐藏并显示</button>
<view v-if="pages.length" style="padding: 15px 0px">
<text>当前页面栈中 {{ pages.length }} 个页面,列表如下:</text>
<template v-for="(page, index) in pages" :key="page.route">
......@@ -18,45 +17,32 @@
<script lang="uts">
class Page {
constructor(public route : string) {
}
constructor(public route : string) {
}
}
export default {
data() {
return {
checked: false,
showTimes: 0,
pages: [] as Page[],
}
},
onShow() {
this.showTimes++
},
methods: {
_getCurrentPages: function () {
this.pages.length = 0
const pages = getCurrentPages()
this.pages.push(new Page(pages[0].route))
if (this.pages[0].route.includes('/tabBar/')) {
this.checked = true
}
for (let i = 1; i < pages.length; i++) {
this.pages.push(new Page(pages[i].route))
if (pages[i].route.includes('/tabBar/')) {
this.checked = false
}
}
},
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())
}
}
},
data() {
return {
checked: false,
pages: [] as Page[],
}
},
methods: {
_getCurrentPages: function () {
this.pages.length = 0
const pages = getCurrentPages()
this.pages.push(new Page(pages[0].route))
if (this.pages[0].route.includes('/tabBar/')) {
this.checked = true
}
for (let i = 1; i < pages.length; i++) {
this.pages.push(new Page(pages[i].route))
if (pages[i].route.includes('/tabBar/')) {
this.checked = false
}
}
},
},
}
</script>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册