<template>
  <el-col :span="span">
    <el-form-item :label="label" :prop="prop" :label-width="labelWidth" :rules="rules" :class="table ? 'table-form-item' : ''">
      <slot></slot>
    </el-form-item>
  </el-col>
</template>

<script>
export default {
  name: 'FormCol',
  props: {
    span: {
      type: Number,
      default: 24
    },
    label: {
      type: String,
      default: null
    },
    prop: {
      type: String,
      default: null
    },
    labelWidth: {
      type: String,
      default: null
    },
    rules: {
      type: Array,
      default: null
    },
    table: {
      type: Boolean,
      default: false
    }
  }
}
</script>

<style scoped lang="scss">
.table-form-item {
  margin: 0;
}
.table-form-item.is-error {
  margin-bottom: 18px;
}
</style>
