<!-- 抽屉弹框组件 -->
<template>
  <app-modal class="app-drawer" :show="show" :close-on-click-mask="false" @mask="close">
    <div class="app-drawer__wrapper" v-loading="loading" element-loading-background="rgba(255, 255, 255, .35)">
      <div class="app-drawer__header">
        <slot name="header">
          <h1>{{ title }}</h1>
        </slot>
        <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>