App.vue 987 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <script setup lang="ts">
  2. import { onHide, onLaunch, onShow } from '@dcloudio/uni-app'
  3. import { navigateToInterceptor } from '@/router/interceptor'
  4. import { tabbarStore } from './tabbar/store'
  5. import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'
  6. onLaunch((options) => {
  7. // 处理直接进入页面路由的情况:如h5直接输入路由、微信小程序分享后进入等
  8. // https://github.com/unibest-tech/unibest/issues/192
  9. console.log('App Launch options: ', options)
  10. const gotoPath = options?.path || ''
  11. navigateToInterceptor.invoke({ url: gotoPath })
  12. // 处理直接进入路由非首页时,tabbarIndex 不正确的问题
  13. tabbarStore.setAutoCurIdx(gotoPath)
  14. })
  15. onShow((options) => {
  16. console.log('App Show', options)
  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>