<template>
  <div class="flex justify-end">
    <el-button @click="closeModal" v-bind="props.cancelButProps">{{
      props.cancelButText
    }}</el-button>
    <el-button
      :loading="subLoading"
      type="primary"
      v-bind="props.confirmButProps"
      @click="handleSubmit"
      >{{ props.confirmButText }}
    </el-button>
  </div>
</template>

<script lang="ts" setup>
  import { inject } from 'vue';

  const props = defineProps({
    confirmButProps: {
      type: Object,
    },
    cancelButProps: {
      type: Object,
    },
    // 确认按钮文字
    confirmButText: {
      type: String,
      default: '确认',
    },
    // 取消按钮文字
    cancelButText: {
      type: String,
      default: '取消',
    },
  });

  const handleSubmit: any = inject('handleSubmit');
  const closeModal: any = inject('closeModal');
  const subLoading = inject('subLoading');
</script>
