<template>
  <div>
    <el-input
      v-if="column.editType === 'input'"
      clearable
      :value="value"
      @input="val => emit('input', val)"
    />

    <el-select
      v-if="column.editType === 'select'"
      :value="value"
      @input="val => emit('input', val)"
    >
      <el-option
        v-for="item in column.selectOptions"
        :key="item.label"
        :label="item.label"
        :value="item.value"
      />
    </el-select>

    <el-date-picker
      v-if="column.editType === 'date'"
      type="date"
      placeholder="选择日期"
      :value="value"
      @input="val => emit('input', val)"
    />
  </div>
</template>

<script setup lang="ts">
import { IColumnConfig } from '../types'

defineProps<{
  column: IColumnConfig;
  value: any;
}>()

const emit = defineEmits<{
  (e: 'input', value: any): void;
}>()
</script>