App.vue 1.13 KB
<!--
 * @Date: 2025-03-20 19:53:12
 * @LastEditors: hookehuyr hookehuyr@gmail.com
 * @LastEditTime: 2025-03-20 20:06:10
 * @FilePath: /vue-vite/src/App.vue
 * @Description: 文件描述
-->
<script setup>
import { RouterView } from "vue-router";
</script>

<template>
  <div>
    <router-view>
      <template v-slot="{ Component }">
        <Suspense>
          <template #default>
            <div>
              <component :is="Component" />
            </div>
          </template>
          <template #fallback>
            <div
              class="flex items-center justify-center h-screen bg-gradient-to-br from-green-50 via-teal-50 to-blue-50"
            >
              <div class="bg-white/20 backdrop-blur-md rounded-xl p-6 shadow-lg">
                <div
                  class="animate-spin rounded-full h-12 w-12 border-b-2 border-green-500 mx-auto"
                ></div>
                <p class="mt-4 text-gray-700">加载中...</p>
              </div>
            </div>
          </template>
        </Suspense>
      </template>
    </router-view>
  </div>
</template>

<style>
#app {
  width: 100%;
  min-height: 100vh;
}
</style>