<template>
  <div class="PublicPageDialog">
    <el-drawer :title="dialogTitle" :visible.sync="dialogDrawer" :size="dialogSize" :direction="dialogDirection" :before-close="handleClose">
      <div class="PublicPageDialog-content">
        <el-scrollbar style="height: 100%" :horizontal="false">
          <slot />
        </el-scrollbar>
      </div>
      <div class="PublicPageDialog-foot">
        <el-button @click="handleClose" size="small">取消</el-button>
        <slot name="d_foot" />
        <el-button @click="handleSubmit" type="primary" size="small">确定</el-button>
      </div>
    </el-drawer>
  </div>
</template>

<script>
export default {
  name: 'PublicPageDialog',
  props: {
    dialogTitle: {
      type: String,
      default: ''
    },
    dialogDrawer: {
      type: Boolean,
      default: false
    },
    dialogDirection: {
      type: String,
      default: 'rtl'
    },
    dialogSize: {
      type: String | Number,
      default: '350px'
    }
  },
  methods: {
    handleClose () {
      this.$emit('handleClose')
    },
    handleSubmit () {
      this.$emit('handleSubmit')
    }
  }
}
</script>

<style lang="scss" scoped>
::v-deep.PublicPageDialog {
  position: relative;
  .el-drawer__header {
    span {
      font-weight: 600;
      font-size: 16px;
      color: #000;
    }
  }

  .el-scrollbar__wrap {
    overflow-x: hidden;
  }
  .is-horizontal {
    display: none;
  }
  .el-select {
    width: 100%;
  }
  &-content {
    padding: 0 20px 20px 20px;
    height: calc(100% - 72px);
    // overflow-y: auto;
  }
  &-foot {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 10;
    text-align: right;
    padding: 20px;
    background-color: rgb(255, 255, 255);
    box-shadow: 0 0 10px 0 hsla(0, 6%, 58%, 0.6);
    transition: all 0.3s ease 0s;
  }
}
</style>

