get-launch-options-sync.uvue 685 字节
Newer Older
DCloud-WZF's avatar
DCloud-WZF 已提交
1 2 3 4
<template>
	<view>
		<page-head title="getLaunchOptionsSync"></page-head>
		<button @click="getLaunchOptionsSync">getLaunchOptionsSync</button>
5
		<text>结果:{{result}}</text>
DCloud-WZF's avatar
DCloud-WZF 已提交
6 7 8 9 10 11
	</view>
</template>
<script>
	export default {
		data() {
			return {
12 13
				checked: false,
				result:""
DCloud-WZF's avatar
DCloud-WZF 已提交
14 15 16
			}
		},
		methods: {
17 18 19 20 21 22 23
			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
				}
DCloud-WZF's avatar
DCloud-WZF 已提交
24 25 26
			}
		}
	}
27
</script>