<script setup>
import { computed } from "vue";
import { useRoute } from "vue-router";
import AdminLayout from "@/components/layout/AdminLayout.vue";
// 导入 Element Plus 语言包
import zhCn from "element-plus/es/locale/lang/zh-cn";
const route = useRoute();

// 当前路由使用的布局类型（来自 meta.layoutType）
const layoutType = computed(() => {
  if (route.meta?.layout === false) return "none";
  return route.meta?.layoutType || "admin";
});
</script>

<template>
  <el-config-provider :locale="zhCn">
    <router-view v-slot="{ Component }">
      <!-- 无布局：登录页 -->
      <component v-if="layoutType === 'none' || !Component" :is="Component" />

      <!-- 统一布局：管理端 / 医院端 共用 AdminLayout，header 内根据路由自动切换样式 -->
      <AdminLayout v-else>
        <component :is="Component" />
      </AdminLayout>
    </router-view>
  </el-config-provider>
</template>

<style></style>
