<template>
  <component :is="formItem.tags" :value="value" :style="formItem.style"
             v-bind="formItem.attrs" @input="setValue">
    <template v-if="formItem.options">
      <ed-option-slot v-for="(option, index) of formItem.options"
                   :key="index"
                   :data="option"
                   :optionAttrs="option.attrs"
                   :tags="formItem.tags"
                   ></ed-option-slot>
    </template>
  </component>
</template>

<script>
export default {
  name: "EdFormItem",
  props: {
    formItem: {
      type: Object
    },
    value: ""
  },
  methods:{
    setValue(val){
      this.$emit('input', val)
    }
  }
}
</script>

<style scoped>

</style>
