mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-27 02:10:40 +01:00
feat(Form): add errors slot prop (#2188)
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<form @submit.prevent="onSubmit">
|
<form @submit.prevent="onSubmit">
|
||||||
<slot />
|
<slot v-bind="{ errors }" />
|
||||||
</form>
|
</form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<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 { useEventBus } from '@vueuse/core'
|
||||||
import type { ZodSchema } from 'zod'
|
import type { ZodSchema } from 'zod'
|
||||||
import type { ValidationError as JoiError, Schema as JoiSchema } from 'joi'
|
import type { ValidationError as JoiError, Schema as JoiSchema } from 'joi'
|
||||||
@@ -181,7 +181,8 @@ export default defineComponent({
|
|||||||
} as Form<any>)
|
} as Form<any>)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
onSubmit
|
onSubmit,
|
||||||
|
errors: readonly(errors)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user