<script setup lang="ts">
import { computed } from "vue";
import { useRoute } from "vue-router";

const route = useRoute();
const key = computed(() => route.path);
</script>

<template>
  <section class="app-main">
    <router-view v-slot="{ Component }" :key="key">
      <transition name="fade-transform" mode="out-in">
        <component :is="Component" />
      </transition>
    </router-view>
  </section>
</template>

<style scoped>
.app-main {
  /*50 = navbar  */
  background-image: url("@/assets/picture/background1.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  min-height: calc(100vh - 50px);
  width: 100%;
  position: relative;
  overflow-y: auto; /* 修改为auto允许垂直滚动 */
  overflow-x: hidden; /* 防止水平滚动 */
}
.fixed-header + .app-main {
  padding-top: 50px;
}
</style>
