App.vue 773 B

1234567891011121314151617181920212223242526272829303132333435
  1. <template>
  2. <div id="app" :style="{ backgroundImage: `url(${backgroundImg})` }">
  3. <Nav />
  4. <div class="content">
  5. <router-view />
  6. </div>
  7. </div>
  8. </template>
  9. <script setup lang="ts">
  10. import { computed } from 'vue';
  11. import { useRoute } from 'vue-router';
  12. import Nav from '@/components/Nav.vue';
  13. const route = useRoute();
  14. const backgroundImg = computed(() => {
  15. return route.path === '/home' ? '/src/assets/images/home/home-bg@1X.png' : '';
  16. });
  17. </script>
  18. <style scoped lang="scss">
  19. #app {
  20. display: flex;
  21. flex-direction: column;
  22. width: 100vw;
  23. height: 100vh;
  24. background-position: center center;
  25. background-repeat: no-repeat;
  26. background-size: cover;
  27. }
  28. .content {
  29. flex: 1;
  30. overflow-y: auto;
  31. }
  32. </style>