<template>
  <div class="confirm-button">
    <a-popconfirm
      :title="title"
      :ok-text="okText"
      :cancel-text="cancelText"
      @confirm="confirm"
      @cancel="close"
    >
      <a-button v-if="buttonStatus" :type="buttonType">{{ text }}</a-button>
      <div v-else class="button_blue">{{ text }}</div>
    </a-popconfirm>
  </div>
</template>

<script lang="ts">
import { defineComponent } from "vue";

export default defineComponent({
  emits: ["confirm", "close"],
  props: {
    title: {
      type: String,
      default: "确认该操作吗?", //提示信息
    },
    okText: {
      type: String,
      default: "确认", //确认按钮
    },
    cancelText: {
      type: String,
      default: "取消", //取消按钮
    },
    text: {
      type: String,
      default: "确认", //按钮文案
    },
    buttonStatus: {
      type: Boolean,
      default: true, //按钮类型 默认为按钮
    },
    buttonType: {
      type: String,
      default: "primary", //按钮类型 默认为按钮
    },
  },
  setup() {},
  methods: {
    confirm() {
      this.$emit("confirm");
      //   确认
    },
    close() {
      this.$emit("close");
      //   取消
    },
  },
});
</script>
