Skip to content

Commit

Permalink
feat(BaseRadioHeadless): use generic component definition
Browse files Browse the repository at this point in the history
  • Loading branch information
stafyniaksacha committed Aug 12, 2023
1 parent adcb7c4 commit ceb48c0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions components/form/BaseRadioHeadless.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<script setup lang="ts">
<script setup lang="ts" generic="T extends any = boolean">
defineOptions({
inheritAttrs: false,
})
const props = withDefaults(
defineProps<{
// Temporary fix to allow attributes inheritance with generic components
// @see https://github.com/vuejs/core/issues/8372
[attrs: string]: any
/**
* The form input identifier.
*/
Expand All @@ -13,12 +17,12 @@ const props = withDefaults(
/**
* The value of the radio input.
*/
value?: any
value?: T
/**
* The model value of the radio input.
*/
modelValue?: any
modelValue?: T
/**
* The name of the radio input.
Expand All @@ -39,7 +43,7 @@ const props = withDefaults(
}
)
const emits = defineEmits<{
(e: 'update:modelValue', value: any): void
(e: 'update:modelValue', value: T): void
}>()
const value = useVModel(props, 'modelValue', emits, {
passive: true,
Expand Down

0 comments on commit ceb48c0

Please sign in to comment.