<template>
  <div class="simple-dialog" v-if="value">
    <div class="simple-dialog__container">
      <span
        class="el-icon-close simple-dialog__colse"
        @click="onCloseClick"
      ></span>
      <div class="simple-dialog__title">
        <span class="simple-dialog__title__text">提示</span>
        <slot name="title"></slot>
      </div>
      <div class="simple-dialog__content">
        <slot></slot>
        <span class="simple-dialog__content__text">这是内容</span>
      </div>
      <div class="simple-dialog__footer">
        <slot name="footer"></slot>
        <div
          class="simple-dialog__confirm"
          v-if="!$slots.footer"
          @click="onClick"
        >
          确定
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  model: {
    prop: 'value',
    event: 'change',
  },
  props: {
    value: {
      type: Boolean,
      default: false,
    },
  },
  methods: {
    onCloseClick() {
      this.$emit('change', false)
    },
    onClick() {
      this.$emit('click')
    },
  },
}
</script>

<style lang="scss" scoped>
.simple-dialog {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.39);

  .simple-dialog__container {
    position: relative;
    width: 76vw;
    min-height: 20vw;
    background: #fff;

    .simple-dialog__colse {
      width: 6.4vw;
      height: 6.4vw;
      font-size: 5vw;
      position: absolute;
      top: 3vw;
      right: 3vw;
      text-align: center;
      line-height: 6.4vw;
      color: #c2c2c2;
    }

    .simple-dialog__title {
      padding: 3vw 4.8vw;
      border-bottom: 1px solid #c2c2c2;
      .simple-dialog__title__text {
        font-size: 4.2vw;
        color: #282828;
      }
    }

    .simple-dialog__content {
      padding: 3vw 4.8vw;

      .simple-dialog__content__text {
        font-size: 3.6vw;
        color: #282828;
      }
    }

    .simple-dialog__footer {
      padding: 0 4.8vw 7vw;
      .simple-dialog__confirm {
        width: 100%;
        height: 8.8vw;
        text-align: center;
        background: #f3920d;
        color: #fff;
        line-height: 8.8vw;
        font-size: 3.6vw;
      }
    }
  }
}
</style>
