<template>
  <div class="modal">
    <a-modal :visible="modalVisible" :title="modalTitle" @ok="handleOk" @cancel="handleCancel">
      <p v-for="(item, index) in modalText" :key="index">{{ item }}</p>
    </a-modal>
  </div>
</template>

<script>
export default {
  props: {
    modalVisible: {
      type: Boolean,
      default: false
    },
    modalTitle: {
      type: String,
      default: '提示'
    },
    modalText: {
      type: Array,
      default: () => []
    },
    modalCallBack: {
      type: Function,
      default: null
    }
  },
  methods: {
    handleOk() {
      this.modalCallBack && this.modalCallBack()
      this.$emit('closeModal')
    },
    handleCancel() {
      this.$emit('closeModal')
    }
  }
}
</script>

<style lang="less" scoped></style>
