Skip to content

Commit

Permalink
fix(VRadioGroup): allow use without defined model
Browse files Browse the repository at this point in the history
  • Loading branch information
johnleider committed Aug 8, 2022
1 parent d938634 commit 38302fe
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/vuetify/src/components/VRadioGroup/VRadioGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import { VSelectionControlGroup } from '@/components/VSelectionControlGroup'

// Composables
import { IconValue } from '@/composables/icons'
import { useProxiedModel } from '@/composables/proxiedModel'

// Utilities
import { computed } from 'vue'
import { computed, toRef } from 'vue'
import { defineComponent, filterInputAttrs, getUid, useRender } from '@/util'

export const VRadioGroup = defineComponent({
Expand Down Expand Up @@ -42,9 +43,14 @@ export const VRadioGroup = defineComponent({
},
},

emits: {
'update:modelValue': (val: any) => true,
},

setup (props, { attrs, slots }) {
const uid = getUid()
const id = computed(() => props.id || `radio-group-${uid}`)
const model = useProxiedModel(props, 'modelValue')

useRender(() => {
const [inputAttrs, controlAttrs] = filterInputAttrs(attrs)
Expand All @@ -62,6 +68,7 @@ export const VRadioGroup = defineComponent({
class="v-radio-group"
{ ...inputAttrs }
{ ...inputProps }
v-model={ model.value }
id={ id.value }
>
{{
Expand All @@ -87,6 +94,7 @@ export const VRadioGroup = defineComponent({
disabled={ isDisabled.value }
readonly={ isReadonly.value }
{ ...controlAttrs }
v-model={ model.value }
v-slots={ slots }
/>
</>
Expand Down

0 comments on commit 38302fe

Please sign in to comment.