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

feat: getLaunchOptionsSync

上级 dc831992
<template> <template>
<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 class="uni-common-pl uni-common-mt">
</view> <text>应用启动路径:</text>
<text style="margin-top:5px;">{{ launchOptionsPath }}</text>
</view>
</view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
checked: false, checked: false,
result:"" homePagePath: '/pages/tabBar/component',
} launchOptionsPath: '',
}, }
methods: { },
getLaunchOptionsSync: function () { methods: {
const launchOptions = uni.getLaunchOptionsSync() getLaunchOptionsSync: function () {
// console.log(launchOptions) const launchOptions = uni.getLaunchOptionsSync()
this.result = JSON.stringify(launchOptions) this.launchOptionsPath = launchOptions.path
if (launchOptions.path != null) { // TODO 需要以各种方式启动hello uni-app x的包,把得到的启动参数传给调用方,进行对比 if (launchOptions.path == this.homePagePath) {
this.checked = true 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.
先完成此消息的编辑!
想要评论请 注册