提交 9b43bb04 编写于 作者: W wanganxp

完善getCurrentPages和启动参数的界面显示

上级 53b81578
<template>
<view>
<page-head title="getCurrentPages"></page-head>
<button @click="getCurrentPages">getCurrentPages</button>
</view>
<view>
<page-head title="getCurrentPages"></page-head>
<button @click="getCurrentPages">getCurrentPages</button>
<text>{{result}}</text>
</view>
</template>
<script>
export default {
data() {
return {
checked: false,
}
},
methods: {
getCurrentPages: function () {
const pages = getCurrentPages()
if (pages[0].route.includes('/tabBar/')) {
this.checked = true
}
for (let i = 1; i < pages.length; i++) {
if (pages[i].route.includes('/tabBar/')) {
this.checked = false
}
}
},
},
}
</script>
export default {
data() {
return {
checked: false,
result:""
}
},
methods: {
getCurrentPages: function () {
const pages = getCurrentPages()
let tmps ="当前页面栈中有" + pages.length.toString() + "个页面。列表如下:\n"
for (let i = 0; i < pages.length; i++) {
tmps = tmps + pages[i].route + "\n"
}
this.result = tmps
// console.log('pages: ',pages.toString());
// TODO 判断条件不对,需要根据自动化测试执行脚本准确验证所有栈内页面
if (pages[0].route.includes('/tabBar/')) {
this.checked = true
}
for (let i = 1; i < pages.length; i++) {
if (pages[i].route.includes('/tabBar/')) {
this.checked = false
}
}
},
},
}
</script>
\ No newline at end of file
......@@ -2,22 +2,26 @@
<view>
<page-head title="getLaunchOptionsSync"></page-head>
<button @click="getLaunchOptionsSync">getLaunchOptionsSync</button>
<text>结果:{{result}}</text>
</view>
</template>
<script>
export default {
data() {
return {
checked: false
checked: false,
result:""
}
},
methods: {
getLaunchOptionsSync: function () {
const launchOptions = uni.getLaunchOptionsSync()
if (launchOptions.path != null) {
this.checked = true
}
getLaunchOptionsSync: function () {
const launchOptions = uni.getLaunchOptionsSync()
// console.log(launchOptions)
this.result = JSON.stringify(launchOptions)
if (launchOptions.path != null) { // TODO 需要以各种方式启动hello uni-app x的包,把得到的启动参数传给调用方,进行对比
this.checked = true
}
}
}
}
</script>
</script>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册