mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-26 01:40:34 +01:00
playground: lint
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user