<template>
  <el-col :span="span">
    <el-form-item :prop="prop" :label-width="labelWidth">
      <template #label>
        <el-tooltip v-if="!isEmpty(tip)" :content="tip" placement="top">
          <i class="el-icon-question" style="margin-right: 5px;cursor: pointer"/>
        </el-tooltip>
        <span>{{label}}</span>
      </template>
      <slot></slot>
    </el-form-item>
  </el-col>
</template>

<script>
import { isEmpty } from '@/utils/index'

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
    },
    tip: {
      type: String,
      default: null
    }
  },
  methods: {
    isEmpty,
  }
}
</script>
