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

test(getCurrentPages): 兼容 web 端

上级 087104f7
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
this.pages.length = 0 this.pages.length = 0
const pages = getCurrentPages() const pages = getCurrentPages()
this.pages.push(new Page(pages[0].route)) this.pages.push(new Page(pages[0].route))
if (this.pages[0].route.includes('/tabBar/')) { if (this.pages[0].route.includes('/tabBar/') || this.pages[0].route == '/') {
this.checked = true this.checked = true
} }
for (let i = 1; i < pages.length; i++) { for (let i = 1; i < pages.length; i++) {
...@@ -142,8 +142,14 @@ ...@@ -142,8 +142,14 @@
check$page() : boolean { check$page() : boolean {
const page = this.getCurrentPage() const page = this.getCurrentPage()
let res = this.$page === page let res = this.$page === page
if(this.testing){ if (this.testing) {
res = res && page.options.get('test') == '123' && page.route == 'pages/API/get-current-pages/get-current-pages' res = res && page.options.get('test') == '123'
// #ifdef WEB
res = page.route == '/pages/API/get-current-pages/get-current-pages'
// #endif
// #ifndef WEB
res = page.route == 'pages/API/get-current-pages/get-current-pages'
// #endif
} }
console.log('check $page', res) console.log('check $page', res)
return res return res
...@@ -200,7 +206,7 @@ ...@@ -200,7 +206,7 @@
const element = page.getElementById('check-get-element-by-id-btn') const element = page.getElementById('check-get-element-by-id-btn')
let res = element != null let res = element != null
// #ifndef APP-ANDROID // #ifndef APP-ANDROID
if(res){ if (res) {
const elPage = element!.getPage() const elPage = element!.getPage()
console.log('elPage', elPage) console.log('elPage', elPage)
res = elPage === page res = elPage === page
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册