playground: lint

This commit is contained in:
Benjamin Canac
2024-04-12 14:00:00 +02:00
parent 786ee8e7e2
commit 02d55b0edb
9 changed files with 26 additions and 28 deletions

View File

@@ -2,7 +2,6 @@
import { z } from 'zod'
import type { FormSubmitEvent, Form } from '#ui/types/form'
const schema = z.object({
input: z.string().min(10),
// inputMenu: z.any().refine(option => option?.value === 'option-2', {
@@ -38,7 +37,7 @@ const options = [
{ label: 'Option 3', value: 'option-3' }
]
function onSubmit (event: FormSubmitEvent<Schema>) {
function onSubmit(event: FormSubmitEvent<Schema>) {
console.log(event.data)
}
</script>
@@ -76,7 +75,7 @@ function onSubmit (event: FormSubmitEvent<Schema>) {
Submit
</UButton>
<UButton variant="outline" :disabled="form?.disabled" @click="form.clear()">
<UButton variant="outline" :disabled="form?.disabled" @click="form?.clear()">
Clear
</UButton>
</div>

View File

@@ -21,11 +21,11 @@ const state = reactive<Partial<Schema & { nested: Partial<NestedSchema> }>>({
const checked = ref(false)
function onSubmit (event: FormSubmitEvent<Schema>) {
function onSubmit(event: FormSubmitEvent<Schema>) {
console.log('Success', event.data)
}
function onError (event: any) {
function onError(event: any) {
console.log('Error', event)
}
</script>

View File

@@ -18,25 +18,25 @@ type ItemSchema = z.output<typeof itemSchema>
const state = reactive<Partial<Schema & { items: Partial<ItemSchema>[] }>>({})
function addItem () {
function addItem() {
if (!state.items) {
state.items = []
}
state.items.push({})
}
function removeItem () {
function removeItem() {
if (state.items) {
state.items.pop()
}
}
const formItemRef = ref()
function onSubmit (event: FormSubmitEvent<Schema>) {
function onSubmit(event: FormSubmitEvent<Schema>) {
console.log('Success', event.data)
}
function onError (event: any) {
function onError(event: any) {
console.log('Error', event)
}
</script>