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

feat: getLaunchOptionsSync

上级 dc831992
<template>
<view>
<page-head title="getLaunchOptionsSync"></page-head>
<button @click="getLaunchOptionsSync">getLaunchOptionsSync</button>
<text>结果:{{result}}</text>
</view>
<view>
<page-head title="getLaunchOptionsSync"></page-head>
<button @click="getLaunchOptionsSync">getLaunchOptionsSync</button>
<view class="uni-common-pl uni-common-mt">
<text>应用启动路径:</text>
<text style="margin-top:5px;">{{ launchOptionsPath }}</text>
</view>
</view>
</template>
<script>
export default {
data() {
return {
checked: false,
result:""
}
},
methods: {
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>
\ No newline at end of file
export default {
data() {
return {
checked: false,
homePagePath: '/pages/tabBar/component',
launchOptionsPath: '',
}
},
methods: {
getLaunchOptionsSync: function () {
const launchOptions = uni.getLaunchOptionsSync()
this.launchOptionsPath = launchOptions.path
if (launchOptions.path == this.homePagePath) {
this.checked = true
}
},
},
}
</script>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册