App.vue 898 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <script setup lang="ts">
  2. import { onHide, onLaunch, onShow } from '@dcloudio/uni-app'
  3. import { navigateToInterceptor } from '@/router/interceptor'
  4. import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'
  5. onLaunch((options) => {
  6. console.log('App Launch', options)
  7. })
  8. onShow((options) => {
  9. console.log('App Show', options)
  10. // 处理直接进入页面路由的情况:如h5直接输入路由、微信小程序分享后进入等
  11. // https://github.com/unibest-tech/unibest/issues/192
  12. if (options?.path) {
  13. navigateToInterceptor.invoke({ url: `/${options.path}`, query: options.query })
  14. }
  15. else {
  16. navigateToInterceptor.invoke({ url: '/' })
  17. }
  18. })
  19. onHide(() => {
  20. console.log('App Hide')
  21. })
  22. </script>
  23. <style lang="scss">
  24. swiper,
  25. scroll-view {
  26. flex: 1;
  27. height: 100%;
  28. overflow: hidden;
  29. }
  30. image {
  31. width: 100%;
  32. height: 100%;
  33. vertical-align: middle;
  34. }
  35. </style>