<template>
  <div class="ConfirmDialog " @click="$emit('dismiss')">
    <div class="content" @click.stop="null">
      <div class="body">
        <div class="title" v-if="title">{{ title }}</div>
        <div class="subtitle" :class="subtitleColor" v-if="subtitle">{{ subtitle }}</div>
      </div>
      <div class="footer">
        <div class="cancel" :class="cancelTextColor" @click.stop="$emit('cancel')">{{ cancelText }}</div>
        <div class="ok" @click.stop="$emit('ok')">{{ okText }}</div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: "ConfirmDialog",
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    title: {
      type: String,
      default() {
        return ''
      }
    },
    subtitle: {
      type: String,
      default() {
        return ''
      }
    },
    subtitleColor: {
      type: String,
      default() {
        return 'gray'
      }
    },
    okText: {
      type: String,
      default() {
        return '确定'
      }
    },
    cancelText: {
      type: String,
      default() {
        return '取消'
      }
    },
    cancelTextColor: {
      type: String,
      default() {
        return 'gray'
      }
    },
  },
  data() {
    return {}
  }
}
</script>

<style scoped lang="scss">
@import "../../assets/scss/index";

.ConfirmDialog {
  z-index: 10;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: #000000bb;
  display: flex;
  justify-content: center;
  align-items: center;
  color: black;


  .content {
    background: white;
    width: 70%;
    border-radius: 2px;
    box-sizing: border-box;
    font-size: 1.5rem;
    text-align: center;

    .body {
      padding: 2.5rem;

      .title {
        font-size: 1.5rem;
        font-weight: bold;
        margin-bottom: 1rem;
      }

      .subtitle {
        font-size: 1.3rem;

        &.gray {
          color: $second-text-color;
        }
      }
    }

    .footer {
      height: 4.6rem;
      display: flex;
      border-top: 1px solid whitesmoke;
      font-size: 1.4rem;

      .cancel, .ok {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 49%;
      }

      .ok {
        font-weight: bold;
      }

      .cancel {
        border-right: 1px solid whitesmoke;

        &.gray {
          color: $second-text-color;
        }
      }

    }

  }


}
</style>
