<template>
  <!-- <div v-if="visible" v-dragDialog="resizeKey" class="custom-dialog" :class="[resizeKey ? resizeKey : '']">
    <div class="d-head">
      <span>{{ $props.title }}</span>
      <div class="head-btn-box flex justify-center items-center" @click="closeDialog">
        <el-icon><close /></el-icon>
      </div>
    </div>
    <div class="d-body">
      <slot></slot>
    </div>
  </div> -->
  <div v-if="visible" class="custom-dialog-wrap">
    <div v-dragDialog="resizeKey" class="custom-dialog" :class="[resizeKey ? resizeKey : '']">
      <div class="d-head">
        <span>{{ $props.title }}</span>
        <div class="head-btn-box flex justify-center items-center" @click="closeDialog">
          <el-icon><close /></el-icon>
        </div>
      </div>
      <div class="d-body">
        <slot></slot>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts" name="CustomDialog">
// import BaseDialog from '../element/BaseDialog.vue'
import useVModel from '@/hooks/useVModel'
import { ref, watch } from 'vue'
import { Close } from '@element-plus/icons-vue'
import { ElIcon } from 'element-plus'

const showDialog = ref(true)

const props = defineProps<{
  title?: string
  modelValue: boolean
  resizeKey?: string
}>()
const visible = useVModel(props)
const closeDialog = () => {
  visible.value = false
}
</script>

<style scoped lang="scss">
.custom-dialog-wrap {
  position: fixed;
  z-index: 2555;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
}
.custom-dialog {
  display: flex;
  flex-direction: column;
  position: fixed;
  z-index: 2666;
  border-radius: 6px;
  box-shadow: 0px 12px 32px 4px rgba(0, 0, 0, 0.04), 0px 8px 20px rgba(0, 0, 0, 0.08);
  .d-head {
    background-color: #f8f8f8;
    border-radius: 6px 6px 0 0;
    color: #333;
    font-size: 14px;
    height: 44px;
    line-height: 44px;
    padding: 0 10px;
    position: relative;
    .head-btn-box {
      position: absolute;
      right: 0;
      top: 0;
      width: 44px;
      height: 44px;
      z-index: 1;
      cursor: pointer;
      &:hover {
        :deep(i) {
          color: $color--primary;
        }
      }
    }
  }
  .d-body {
    height: calc(100% - 44px);
  }
}
</style>
