<template>
  <t-dialog
    v-model:visible="visible"
    attach="body"
    placement="center"
    :footer="false"
    class="custom-img-dialog"
  >
    <template #header>
      <div>请耐心等待文字生成</div>
    </template>
    <template #body>
      <div class="custom-dialog-body">
        <div class="content narrow-scrollbar">{{ text }}</div>
        <Animation v-show="dialogloading"></Animation>
      </div>
    </template>
  </t-dialog>
</template>

<script lang="ts" setup>
import {
  Dialog as TDialog,
  Button as TButton,
  Loading as TLoading,
} from 'tdesign-vue-next';
import { PropType, ref, watch } from 'vue';
import Animation from '@/components/Animation.vue';
const props = defineProps({
  modelValue: Boolean,
  list: Array as PropType<any[]>,
  dialogloading: Boolean,
  text: String,
});
const emit = defineEmits(['update:modelValue', 'SubmitSplit']);
const visible = ref(props.modelValue);
watch(
  () => props.modelValue,
  (v) => {
    visible.value = v;
  }
);

watch(
  () => visible.value,
  (v) => {
    emit('update:modelValue', v);
  }
);
</script>

<style lang="less">
.custom-img-dialog {
  .t-dialog {
    width: 50vw;
    max-width: 50vw;
    .t-dialog__body {
      overflow: hidden;
    }
  }
  .custom-dialog-body {
    height: 500px;
    box-sizing: border-box;
    .content {
      height: 450px;
      overflow-y: auto;
      .img-box {
        display: flex;
        justify-content: space-between;
        .img {
          width: 300px;
          height: 300px;
        }
        .split_img_loading {
          width: 300px;
          height: 300px;
          display: flex;
          align-items: center;
          justify-content: center;
        }
      }
      .btns {
        margin: 20px 0;
        & > :not(:nth-child(1)) {
          margin-left: 12px;
        }
      }
    }
    .custom-loading-box {
      position: relative !important;
      width: auto !important;
      height: 50px !important;
    }
  }
}
</style>
