<template>
    <hc-body :padding="isPadding ? '12px' : '0px'">
        <router-view v-slot="{ Component }">
            <transition name="fade-transform">
                <keep-alive :max="10">
                    <component :is="Component" />
                </keep-alive>
            </transition>
        </router-view>
    </hc-body>
</template>

<script setup>
import { onMounted, ref, watch } from 'vue'
import { useRoute } from 'vue-router'

//初始组合式
const useRoutes = useRoute()

//渲染完成
onMounted(() => {
    setBarRoutesData(useRoutes?.name)
})

//监听
watch(() => useRoutes?.name, (name) => {
    setBarRoutesData(name)
})

//判断数据
const routes = ['/certificate/management', '/certificate/list', 'projectinfo/list']
const isPadding = ref(true)
const setBarRoutesData = (name) => {
    isPadding.value = routes.indexOf(name) === -1
}
</script>
