# uni.getLaunchOptionsSync()

获取本次启动时的参数。返回值与App.onLaunch的回调参数一致

# # Return value

Type
OnLaunchOptions

# # OnLaunchOptions Values

name type optinal default description
path string YES - -

# # See also

getLaunchOptionsSync

Related Bug

# # Example

hello uni-app x

<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>

# # General type

# # GeneralCallbackResult

name type optinal default description
errMsg string YES - 错误信息