mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-30 19:57:55 +01:00
docs(form): improve types
This commit is contained in:
@@ -14,7 +14,7 @@ const validate = (state: any): FormError[] => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
async function onSubmit(event: FormSubmitEvent<any>) {
|
async function onSubmit(event: FormSubmitEvent<typeof state>) {
|
||||||
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'success' })
|
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'success' })
|
||||||
console.log(event.data)
|
console.log(event.data)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ const items = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
async function onSubmit(event: FormSubmitEvent<any>) {
|
async function onSubmit(event: FormSubmitEvent<Schema>) {
|
||||||
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'success' })
|
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'success' })
|
||||||
console.log(event.data)
|
console.log(event.data)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const state = reactive({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
async function onSubmit(event: FormSubmitEvent<any>) {
|
async function onSubmit(event: FormSubmitEvent<typeof schema>) {
|
||||||
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'success' })
|
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'success' })
|
||||||
console.log(event.data)
|
console.log(event.data)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type NestedSchema = z.output<typeof nestedSchema>
|
|||||||
const state = reactive<Partial<Schema & NestedSchema>>({ })
|
const state = reactive<Partial<Schema & NestedSchema>>({ })
|
||||||
|
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
async function onSubmit(event: FormSubmitEvent<any>) {
|
async function onSubmit(event: FormSubmitEvent<Schema>) {
|
||||||
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'success' })
|
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'success' })
|
||||||
console.log(event.data)
|
console.log(event.data)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ function removeItem() {
|
|||||||
|
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
|
|
||||||
async function onSubmit(event: FormSubmitEvent<any>) {
|
async function onSubmit(event: FormSubmitEvent<Schema>) {
|
||||||
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'success' })
|
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'success' })
|
||||||
console.log(event.data)
|
console.log(event.data)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ const validate = (state: any): FormError[] => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
async function onSubmit(event: FormSubmitEvent<any>) {
|
async function onSubmit(event: FormSubmitEvent<typeof state>) {
|
||||||
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'success' })
|
toast.add({ title: 'Success', description: 'The form has been submitted.', color: 'success' })
|
||||||
console.log(event.data)
|
console.log(event.data)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ const activating = ref(false)
|
|||||||
const successMessage = ref()
|
const successMessage = ref()
|
||||||
const errorMessage = ref('')
|
const errorMessage = ref('')
|
||||||
|
|
||||||
async function submit(event: FormSubmitEvent<any>) {
|
async function submit(event: FormSubmitEvent<Schema>) {
|
||||||
activating.value = true
|
activating.value = true
|
||||||
errorMessage.value = ''
|
errorMessage.value = ''
|
||||||
successMessage.value = ''
|
successMessage.value = ''
|
||||||
|
|||||||
Reference in New Issue
Block a user