App.vue 689 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <template>
  2. <a-config-provider
  3. :theme="{
  4. token: {
  5. colorPrimary: '#bd4b36',
  6. },
  7. }"
  8. >
  9. <NavBar />
  10. <main>
  11. <RouterView />
  12. </main>
  13. <Footer />
  14. </a-config-provider>
  15. </template>
  16. <script setup lang="ts">
  17. import { onMounted, watch } from 'vue';
  18. import { RouterView, useRoute } from 'vue-router'
  19. import NavBar from './components/NavBar.vue';
  20. import Footer from './components/Footer.vue';
  21. import { useAuthStore } from './stores/auth';
  22. const authStore = useAuthStore();
  23. onMounted(() => {
  24. authStore.loadLoginState();
  25. });
  26. const route = useRoute();
  27. watch(route, () => {
  28. window.scrollTo({
  29. top: 0,
  30. behavior: 'instant'
  31. })
  32. });
  33. </script>