App.vue 829 B

1234567891011121314151617181920212223242526272829303132333435363738
  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 Launch', options)
  6. })
  7. onShow((options) => {
  8. console.log('App Show', 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. swiper,
  24. scroll-view {
  25. flex: 1;
  26. height: 100%;
  27. overflow: hidden;
  28. }
  29. image {
  30. width: 100%;
  31. height: 100%;
  32. vertical-align: middle;
  33. }
  34. </style>