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

test(getCurrentPages): 兼容 web 端

上级 087104f7
......@@ -92,7 +92,7 @@
this.pages.length = 0
const pages = getCurrentPages()
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
}
for (let i = 1; i < pages.length; i++) {
......@@ -142,8 +142,14 @@
check$page() : boolean {
const page = this.getCurrentPage()
let res = this.$page === page
if(this.testing){
res = res && page.options.get('test') == '123' && page.route == 'pages/API/get-current-pages/get-current-pages'
if (this.testing) {
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)
return res
......@@ -197,13 +203,13 @@
},
checkGetElementById() : boolean {
const page = this.getCurrentPage()
const element = page.getElementById('check-get-element-by-id-btn')
let res = element != null
// #ifndef APP-ANDROID
if(res){
const elPage = element!.getPage()
console.log('elPage', elPage)
res = elPage === page
const element = page.getElementById('check-get-element-by-id-btn')
let res = element != null
// #ifndef APP-ANDROID
if (res) {
const elPage = element!.getPage()
console.log('elPage', elPage)
res = elPage === page
}
// #endif
console.log('check getElementById', res)
......@@ -265,4 +271,4 @@
.radio-value {
margin-left: 10px;
}
</style>
</style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册