fix(RadioGroup): props reactivity issues (#1065)

This commit is contained in:
Romain Hamel
2023-12-06 17:15:05 +01:00
committed by GitHub
parent 1cb8df869f
commit 7196d81b4c
2 changed files with 4 additions and 3 deletions

View File

@@ -99,7 +99,7 @@ export default defineComponent({
const { ui, attrs } = useUI('radioGroup', toRef(props, 'ui'), config, toRef(props, 'class'))
const { ui: uiRadio } = useUI('radio', toRef(props, 'uiRadio'), configRadio)
const { emitFormChange, color, name } = useFormGroup({ ...props, isFieldset: true }, config)
const { emitFormChange, color, name } = useFormGroup(props, config)
provide('radio-group', { color, name })
const onUpdate = (value: any) => {

View File

@@ -8,8 +8,8 @@ type InputProps = {
size?: string | number | symbol
color?: string
name?: string
isFieldset?: boolean
eagerValidation?: boolean
legend?: string | null
}
export const useFormGroup = (inputProps?: InputProps, config?: any) => {
@@ -20,7 +20,8 @@ export const useFormGroup = (inputProps?: InputProps, config?: any) => {
const inputId = ref(inputProps?.id)
onMounted(() => {
inputId.value = inputProps?.isFieldset ? undefined : inputProps?.id ?? uid()
// Remove FormGroup label bindings for RadioGroup elements to avoid label conflicts
inputId.value = inputProps?.legend === null || inputProps.legend ? undefined : inputProps?.id ?? uid()
if (formGroup) {
// Updates for="..." attribute on label if inputProps.id is provided