App.vue 796 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <template>
  2. <router-view></router-view>
  3. </template>
  4. <script lang="ts" setup>
  5. import { onMounted } from 'vue';
  6. import { loginMessage } from '@/hooks/use-login';
  7. import { useUserStore } from '@/store/user';
  8. import cache from '@/utils/cache';
  9. const userStore = useUserStore();
  10. onMounted(() => {
  11. loginMessage();
  12. const token = cache.getStorageExp('token');
  13. if (token) {
  14. userStore.setToken(token);
  15. userStore.getUserInfo();
  16. }
  17. // 启用vconsole
  18. // import('vconsole')
  19. // .then((VConsole) => {
  20. // // eslint-disable-next-line
  21. // new VConsole.default();
  22. // })
  23. // .catch(() => {});
  24. });
  25. </script>
  26. <style lang="scss">
  27. body {
  28. font-size: 16px;
  29. // naive的message会影响全局line-height
  30. line-height: initial;
  31. }
  32. </style>
  33. <style lang="scss" scoped></style>