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

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

上级 53b81578
...@@ -2,18 +2,27 @@ ...@@ -2,18 +2,27 @@
<view> <view>
<page-head title="getCurrentPages"></page-head> <page-head title="getCurrentPages"></page-head>
<button @click="getCurrentPages">getCurrentPages</button> <button @click="getCurrentPages">getCurrentPages</button>
<text>{{result}}</text>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
checked: false, checked: false,
result:""
} }
}, },
methods: { methods: {
getCurrentPages: function () { getCurrentPages: function () {
const pages = getCurrentPages() 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/')) { if (pages[0].route.includes('/tabBar/')) {
this.checked = true this.checked = true
} }
...@@ -24,5 +33,5 @@ export default { ...@@ -24,5 +33,5 @@ export default {
} }
}, },
}, },
} }
</script> </script>
\ No newline at end of file
...@@ -2,19 +2,23 @@ ...@@ -2,19 +2,23 @@
<view> <view>
<page-head title="getLaunchOptionsSync"></page-head> <page-head title="getLaunchOptionsSync"></page-head>
<button @click="getLaunchOptionsSync">getLaunchOptionsSync</button> <button @click="getLaunchOptionsSync">getLaunchOptionsSync</button>
<text>结果:{{result}}</text>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
checked: false checked: false,
result:""
} }
}, },
methods: { methods: {
getLaunchOptionsSync: function () { getLaunchOptionsSync: function () {
const launchOptions = uni.getLaunchOptionsSync() const launchOptions = uni.getLaunchOptionsSync()
if (launchOptions.path != null) { // console.log(launchOptions)
this.result = JSON.stringify(launchOptions)
if (launchOptions.path != null) { // TODO 需要以各种方式启动hello uni-app x的包,把得到的启动参数传给调用方,进行对比
this.checked = true this.checked = true
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册