App.vue 699 B

1234567891011121314151617181920212223242526272829
  1. <script setup lang="ts">
  2. import { onLaunch, onShow, onHide } from '@dcloudio/uni-app';
  3. import { useAuthStore } from '@/store/modules/auth';
  4. import { autoLogin } from '@/utils/routeGuard';
  5. onLaunch(async () => {
  6. console.log('App Launch');
  7. // 应用启动时检查登录状态
  8. try {
  9. await autoLogin();
  10. } catch (error) {
  11. console.error('Auto login check failed:', error);
  12. }
  13. });
  14. onShow(() => {
  15. console.log('App Show');
  16. });
  17. onHide(() => {
  18. console.log('App Hide');
  19. });
  20. </script>
  21. <style lang="scss">
  22. @import '@/assets/styles/public.scss';
  23. @import '@/assets/styles/common.scss';
  24. @import '@/assets/styles/uview-plus.scss';
  25. </style>