mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 20:19:34 +01:00
fix(FormGroup): remove id when used with RadioGroup (#2152)
This commit is contained in:
@@ -104,7 +104,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, config)
|
||||
const { emitFormChange, color, name } = useFormGroup(props, config, false)
|
||||
provide('radio-group', { color, name })
|
||||
|
||||
const onUpdate = (value: any) => {
|
||||
|
||||
@@ -12,13 +12,15 @@ type InputProps = {
|
||||
}
|
||||
|
||||
|
||||
export const useFormGroup = (inputProps?: InputProps, config?: any) => {
|
||||
export const useFormGroup = (inputProps?: InputProps, config?: any, bind: boolean = true) => {
|
||||
const formBus = inject<UseEventBusReturn<FormEvent, string> | undefined>('form-events', undefined)
|
||||
const formGroup = inject<InjectedFormGroupValue | undefined>('form-group', undefined)
|
||||
const formInputs = inject<any>('form-inputs', undefined)
|
||||
|
||||
if (formGroup) {
|
||||
if (inputProps?.id) {
|
||||
if (!bind || inputProps.legend) {
|
||||
formGroup.inputId.value = undefined
|
||||
} else if (inputProps?.id) {
|
||||
// Updates for="..." attribute on label if inputProps.id is provided
|
||||
formGroup.inputId.value = inputProps?.id
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user