get-launch-options-sync.uvue 849 字节
Newer Older
DCloud-WZF's avatar
DCloud-WZF 已提交
1
<template>
DCloud-WZF's avatar
DCloud-WZF 已提交
2 3
  <view>
    <page-head title="getLaunchOptionsSync"></page-head>
DCloud-WZF's avatar
DCloud-WZF 已提交
4 5 6 7 8 9
    <view class="uni-padding-wrap">
      <button @click="getLaunchOptionsSync">getLaunchOptionsSync</button>
      <view v-if="launchOptionsPath.length > 0" class="uni-common-mt">
        <text>应用启动路径:</text>
        <text style="margin-top: 5px">{{ launchOptionsPath }}</text>
      </view>
DCloud-WZF's avatar
DCloud-WZF 已提交
10 11
    </view>
  </view>
DCloud-WZF's avatar
DCloud-WZF 已提交
12
</template>
DCloud-WZF's avatar
DCloud-WZF 已提交
13

DCloud-WZF's avatar
DCloud-WZF 已提交
14
<script lang="uts">
DCloud-WZF's avatar
DCloud-WZF 已提交
15 16 17 18 19 20 21 22 23
export default {
  data() {
    return {
      checked: false,
      homePagePath: '/pages/tabBar/component',
      launchOptionsPath: '',
    }
  },
  methods: {
DCloud-WZF's avatar
DCloud-WZF 已提交
24
    getLaunchOptionsSync() {
DCloud-WZF's avatar
DCloud-WZF 已提交
25 26 27 28 29 30 31 32 33
      const launchOptions = uni.getLaunchOptionsSync()
      this.launchOptionsPath = launchOptions.path
      if (launchOptions.path == this.homePagePath) {
        this.checked = true
      }
    },
  },
}
</script>