<template>
  <div :style="{height: height}" class="ed-dialog-footer--warp">
    <slot name="footer">
      <slot name="insertFooter"></slot>
      <el-button v-if="showCancelBtn" v-bind="cancelButtonProps" @click="handleClose"> {{ cancelText }}</el-button>
      <slot name="centerFooter"></slot>
      <el-button v-if="showOkBtn" :loading="loading" v-bind="okButtonProps" @click="handleOk"> {{ okText }}</el-button>
      <slot name="appendFooter"></slot>
    </slot>
  </div>
</template>

<script>
import {FooterProps} from '../Props'
import {getVarType}  from "../../../../tools/utils";

export default {
  name: "DialogFooter",
  props: FooterProps,
  computed: {
    height() {
      return getVarType(this.footerHeight) === "string" ? this.footerHeight : `${this.footerHeight}px`;
    }
  },
  methods: {
    handleClose(e) {
      this.$emit('close', e)
    },
    handleOk(e) {
      this.$emit('ok', e)
    },
  }
}
</script>

<style scoped>
.ed-dialog-footer--warp {
  display: flex;
  align-items: center;
  padding: 0 16px;
}
</style>
