Skip to content

Commit

Permalink
feat(Form): add errors slot prop (#2188)
Browse files Browse the repository at this point in the history
  • Loading branch information
romhml authored Sep 12, 2024
1 parent bf32baa commit 67c6a74
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/runtime/components/forms/Form.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<template>
<form @submit.prevent="onSubmit">
<slot />
<slot v-bind="{ errors }" />
</form>
</template>

<script lang="ts">
import { provide, ref, type PropType, defineComponent, onUnmounted, onMounted } from 'vue'
import { provide, ref, type PropType, defineComponent, onUnmounted, onMounted, readonly } from 'vue'
import { useEventBus } from '@vueuse/core'
import type { ZodSchema } from 'zod'
import type { ValidationError as JoiError, Schema as JoiSchema } from 'joi'
Expand Down Expand Up @@ -181,7 +181,8 @@ export default defineComponent({
} as Form<any>)
return {
onSubmit
onSubmit,
errors: readonly(errors)
}
}
})
Expand Down

0 comments on commit 67c6a74

Please sign in to comment.