Skip to content

Commit 67c6a74

Browse files
authored
feat(Form): add errors slot prop (#2188)
1 parent bf32baa commit 67c6a74

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

‎src/runtime/components/forms/Form.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<template>
22
<form @submit.prevent="onSubmit">
3-
<slot />
3+
<slot v-bind="{ errors }" />
44
</form>
55
</template>
66

77
<script lang="ts">
8-
import { provide, ref, type PropType, defineComponent, onUnmounted, onMounted } from 'vue'
8+
import { provide, ref, type PropType, defineComponent, onUnmounted, onMounted, readonly } from 'vue'
99
import { useEventBus } from '@vueuse/core'
1010
import type { ZodSchema } from 'zod'
1111
import type { ValidationError as JoiError, Schema as JoiSchema } from 'joi'
@@ -181,7 +181,8 @@ export default defineComponent({
181181
} as Form<any>)
182182
183183
return {
184-
onSubmit
184+
onSubmit,
185+
errors: readonly(errors)
185186
}
186187
}
187188
})

0 commit comments

Comments
 (0)