<template>
  <t-dialog
    v-model:visible="visible"
    attach="body"
    placement="center"
    :confirm-on-enter="true"
    :on-cancel="onCancel"
    :on-confirm="onConfirmAnother"
  >
    <template #header>
      <div>请确认是否提交</div>
    </template>
    <template #body> </template>
  </t-dialog>
</template>

<script lang="ts" setup>
import { ref, watch } from 'vue';
import { Dialog as TDialog } from 'tdesign-vue-next';
const props = defineProps({
  modelValue: Boolean,
});
const emit = defineEmits(['update:modelValue', 'Submit']);

const visible = ref(false);
const onCancel = (context: any) => {
  //
  console.log('onCancel');
};
// 确认按钮
const onConfirmAnother = (context: any) => {
  // 通知页面发起请求
  visible.value = false;
  emit('Submit');
};
watch(
  () => props.modelValue,
  (v) => {
    visible.value = v;
  }
);
watch(
  () => visible.value,
  (v) => {
    emit('update:modelValue', v);
  }
);
</script>

<style lang="less">
.custom-confirm-dialog {
}
</style>
