<template>
  <div class="pop-box">
    <div class="main">
      <p>
        {{title}}
      </p>
      <div class="prompt">
        {{prompt}}
      </div>
      <div class="button">
        <div>
          <slot name="button"></slot>
        </div>
      </div>
      <div class="out" @click="close"></div>
    </div>
  </div>
</template>
<script>
export default {
  props: ['title', 'prompt'],
  methods: {
    close() {
      this.$emit('close')
    }
  }
}
</script>
<style lang="scss" scoped>
.pop-box{
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,.5);
}
.main{
  position: absolute;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%);
  width: 342px;
  height: 220px;
  background-color: #fff;
  border-radius: 15px;
  p{
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 18px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #222222;
  }
  .prompt {
    position: absolute;
    left: 50%;
    top: 50px;
    transform: translateX(-50%);
    width: 280px;
    height: auto;
    text-align: center;
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #222222;
  }
  .button {
    display:flex;
    justify-content: center;
    width: 100%;
    position: absolute;
    height: 40px;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    button {
      // display:inline-block;
      float: left;
      border: 1px solid #eee;
      background-color: #fff;
      width: 120px;
      height: 40px;
      margin-right: 22px;
      line-height: 40px;
      text-align: center;
      font-size: 14px;
      font-family: PingFangSC-Semibold, PingFang SC;
      font-weight: 600;
      color: #666666;
      outline: none;
      border-radius: 5px;
    }
    button:focus{
      border: 0.5px solid lightblue;
    }
    button:hover{
      cursor: pointer;
    }
    button:nth-child(2) {
      margin-right: 0px;
    }
  }
  .out {
    position: absolute;
    right: -30px;
    width: 23px;
    height: 23px;
    background-image: url(../../assets/images/out-btn.png);
  }
  .out:hover {
    cursor: pointer;
  }
}
</style>
