<template>
  <el-radio-group class="custom-radio">
    <template v-for="option in props.options" :key="option.key || option.value">
      <component :is="props.type === 'button' ? ElRadioButton : ElRadio" v-bind="option">
        <template v-if="option?.slotLabel" #default>{{ option?.slotLabel }}</template>
      </component>
    </template>
  </el-radio-group>
</template>

<script setup lang="ts" name="EpRadio">
import { ElRadioGroup, ElRadio, ElRadioButton } from 'element-plus'
import type { FormItemRadioCustomProp } from 'global-type'

interface RadioProp {
  type?: 'radio' | 'button'
  options: FormItemRadioCustomProp['options']
}

const props = defineProps<RadioProp>()
</script>

<style scoped lang="scss"></style>
