<template>
  <t-drawer v-bind="attrs">
    <template #body v-if="isFirstOpen">
      <slot></slot>
    </template>
    <template #footer v-if="slots.foot">
      <slot name="foot"></slot>
    </template>
  </t-drawer>
</template>
<script setup name="MyDrawer">
import { useAttrs, useSlots, ref, watch } from 'vue';
const attrs = useAttrs();
const slots = useSlots();
let isFirstOpen = ref(false);
watch(
  () => attrs.visible,
  () => {
    if (!isFirstOpen.value) {
      isFirstOpen.value = true;
      if (attrs.callBacks) {
        attrs.callBacks.forEach((item) => item());
      }
    }
  }
);
</script>
