<!-- 抽屉弹框组件 -->
<template>
  <app-modal class="app-drawer" :show="show" :close-on-click-mask="false" @mask="close">
    <div class="app-drawer__wrapper" v-loading="loading">
      <div class="app-drawer__header">
        <h1>{{  title  }}</h1>
        <el-icon @click="close">
          <Close />
        </el-icon>
      </div>
      <div class="app-drawer__body">
        <slot></slot>
      </div>
      <div class="app-drawer__footer" v-if="$slots.footer">
        <slot name="footer"></slot>
      </div>
    </div>
  </app-modal>
</template>

<script lang="ts" setup>
import AppModal from '@/components/base/modal/index.vue'

const emit = defineEmits(['update:show'])

defineProps({
  show: {
    type: Boolean,
    default: false,
  },
  title: {
    type: String,
    default: '',
  },
  loading: {
    type: Boolean,
    default: false,
  },
})

const close = () => {
  emit('update:show', false);
}
</script>

<style lang="less">
@import './index.less';
</style>