chore(FormGroup): simplify bindings between input and form group p… (#704)

Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
Romain Hamel
2023-09-21 23:22:55 +02:00
committed by GitHub
parent a94782d94b
commit 46879dc1b7
14 changed files with 81 additions and 65 deletions

View File

@@ -1,6 +1,6 @@
<template>
<HSwitch
:id="id"
:id="inputId"
v-model="active"
:name="name"
:disabled="disabled"
@@ -82,9 +82,7 @@ export default defineComponent({
setup (props, { emit }) {
const { ui, attrs, attrsClass } = useUI('toggle', props.ui, config)
const { emitFormChange, formGroup } = useFormGroup(props)
const color = computed(() => formGroup?.error?.value ? 'red' : props.color)
const id = formGroup?.labelFor
const { emitFormChange, color, inputId, name } = useFormGroup(props)
const active = computed({
get () {
@@ -122,7 +120,8 @@ export default defineComponent({
ui,
attrs,
// eslint-disable-next-line vue/no-dupe-keys
id,
name,
inputId,
active,
switchClass,
onIconClass,