App.vue 703 B

123456789101112131415161718192021222324252627
  1. <script setup lang="ts">
  2. import { onHide, onLaunch, onShow } from '@dcloudio/uni-app'
  3. import { navigateToInterceptor } from '@/router/interceptor'
  4. onLaunch((options) => {
  5. console.log('App.vue onLaunch', options)
  6. })
  7. onShow((options) => {
  8. console.log('App.vue onShow', options)
  9. // 处理直接进入页面路由的情况:如h5直接输入路由、微信小程序分享后进入等
  10. // https://github.com/unibest-tech/unibest/issues/192
  11. if (options?.path) {
  12. navigateToInterceptor.invoke({ url: `/${options.path}`, query: options.query })
  13. }
  14. else {
  15. navigateToInterceptor.invoke({ url: '/' })
  16. }
  17. })
  18. onHide(() => {
  19. console.log('App Hide')
  20. })
  21. </script>
  22. <style lang="scss">
  23. </style>