<template>
  <view>
    <page-head title="getLaunchOptionsSync"></page-head>
    <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>
    </view>
  </view>
</template>

<script lang="uts">
export default {
  data() {
    return {
      checked: false,
      homePagePath: '/pages/tabBar/component',
      launchOptionsPath: '',
    }
  },
  methods: {
    getLaunchOptionsSync() {
      const launchOptions = uni.getLaunchOptionsSync()
      this.launchOptionsPath = launchOptions.path
      if (launchOptions.path == this.homePagePath) {
        this.checked = true
      }
    },
  },
}
</script>
