<template>
  <div class="hb-form-bottom" :style="{ width: width, 'justify-content': horizontal == 'left' ? 'flex-start' : horizontal == 'right' ? 'flex-end' : 'center' }">
    <slot></slot>
  </div>
</template>

<script>
export default {
  name: 'HbFormBottom',
  inject: ['layoutVm'],
  props: {
    horizontal: {
      type: String,
      // 可选值： left：居左 right：居右
      default: 'center'
    }
  },
  data() {
    return {
      width: '0px'
    };
  },
  mounted() {
    this.width = this.$parent.$el.offsetWidth + 'px';
    this.layoutVm.pagePaddingBottom = this.$el.offsetHeight + 'px';
  },
  beforeDestroy() {
    this.layoutVm.pagePaddingBottom = null;
  }
};
</script>

<style lang="scss" scoped>
.hb-form-bottom {
  display: flex;
  align-items: center;
  position: fixed;
  right: 0;
  bottom: 0;
  z-index: 100;
  width: calc(100% - 12px);
  height: 56px;
  background: #ffffff;
  box-shadow: 1px -2px 8px 0px rgba(220, 223, 230, 0.6);
}
</style>
