Skip to content

Commit dbf46cb

Browse files
committed
feat(form): rename $save to $submit
1 parent fec11b1 commit dbf46cb

File tree

15 files changed

+54
-40
lines changed

15 files changed

+54
-40
lines changed

docs/guide/data/form.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The form object is a reactive object that contains the data of the form. You can
1919
It has several special properties:
2020

2121
- `$reset()`: a method that resets the form to its initial state.
22-
- `$save()`: a method that saves the form and creates a new item.
22+
- `$submit()`: a method that saves the form and creates a new item.
2323
- `$loading`: a boolean that indicates whether the form is being saved.
2424
- `$error`: an error object that contains the error if the form could not be saved.
2525
- `$schema` the validation schema for the form object (see [schema validation](#schema-validation)).
@@ -39,7 +39,7 @@ createTodo.$onSaved(() => {
3939
</script>
4040
4141
<template>
42-
<form @submit.prevent="createTodo.$save()">
42+
<form @submit.prevent="createTodo.$submit()">
4343
<!-- Input -->
4444
<input ref="input" v-model="createTodo.title">
4545
<!-- Submit -->
@@ -81,7 +81,7 @@ The update for object has the following special properties:
8181

8282
- `$reset()`: a method that resets the form to its initial state.
8383

84-
- `$save()`: a method that saves the form and updates the item.
84+
- `$submit()`: a method that saves the form and updates the item.
8585

8686
- `$loading`: a boolean that indicates whether the form is being saved.
8787

@@ -116,7 +116,7 @@ updateTodo.$onSaved(() => emit('close'))
116116
</script>
117117
118118
<template>
119-
<form @submit.prevent="updateTodo.$save()">
119+
<form @submit.prevent="updateTodo.$submit()">
120120
<!-- Input -->
121121
<input v-model="updateTodo.title">
122122
<!-- Submit -->
@@ -173,7 +173,7 @@ const createTodo = store.todos.createForm()
173173
<UForm
174174
:state="createTodo"
175175
:schema="createTodo.$schema"
176-
@submit="createTodo.$save()"
176+
@submit="createTodo.$submit()"
177177
>
178178
<!-- UFormFields here -->
179179
</UForm>

docs/guide/model/model.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ const createTodo = store.todos.createForm()
245245
<UForm
246246
:state="createTodo"
247247
:schema="createTodo.$schema"
248-
@submit="createTodo.$save()"
248+
@submit="createTodo.$submit()"
249249
>
250250
<!-- UFormFields here -->
251251
</UForm>

packages/playground-drizzle-2/app/components/todo/TodoEditForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ updateTodo.$onSaved(() => emit('close'))
1818
:state="updateTodo"
1919
:schema="updateTodo.$schema"
2020
class="flex flex-col gap-4"
21-
@submit="updateTodo.$save()"
21+
@submit="updateTodo.$submit()"
2222
>
2323
<UFormField
2424
label="Text"

packages/playground-drizzle-2/app/pages/todo.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ createTodo.$onSaved(() => {
1717
:state="createTodo"
1818
:schema="createTodo.$schema"
1919
class="mb-4"
20-
@submit="createTodo.$save()"
20+
@submit="createTodo.$submit()"
2121
>
2222
<UButtonGroup
2323
class="w-full"
@@ -29,7 +29,7 @@ createTodo.$onSaved(() => {
2929
autofocus
3030
size="xl"
3131
class="w-full"
32-
@keydown.enter.prevent="createTodo.$save()"
32+
@keydown.enter.prevent="createTodo.$submit()"
3333
/>
3434

3535
<UButton

packages/playground-drizzle/app/app.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ createTodo.$onSaved(() => {
2525
:state="createTodo"
2626
:schema="createTodo.$schema"
2727
class="flex-1 min-w-0"
28-
@submit="createTodo.$save()"
28+
@submit="createTodo.$submit()"
2929
>
3030
<UButtonGroup
3131
class="w-full"
@@ -37,7 +37,7 @@ createTodo.$onSaved(() => {
3737
autofocus
3838
size="xl"
3939
class="w-full"
40-
@keydown.enter.prevent="createTodo.$save()"
40+
@keydown.enter.prevent="createTodo.$submit()"
4141
/>
4242

4343
<UButton

packages/playground-drizzle/app/components/todo/TodoEditForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ updateTodo.$onSaved(() => emit('close'))
1818
:state="updateTodo"
1919
:schema="updateTodo.$schema"
2020
class="flex flex-col gap-4"
21-
@submit="updateTodo.$save()"
21+
@submit="updateTodo.$submit()"
2222
>
2323
<UFormField
2424
label="Text"

packages/playground-nuxt-directus/app/app.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ createTodo.$onSaved(() => {
3131
:state="createTodo"
3232
:schema="createTodo.$schema"
3333
class="flex-1 min-w-0"
34-
@submit="createTodo.$save()"
34+
@submit="createTodo.$submit()"
3535
>
3636
<UButtonGroup
3737
class="w-full"
@@ -43,7 +43,7 @@ createTodo.$onSaved(() => {
4343
autofocus
4444
size="xl"
4545
class="w-full"
46-
@keydown.enter.prevent="createTodo.$save()"
46+
@keydown.enter.prevent="createTodo.$submit()"
4747
/>
4848

4949
<UButton

packages/playground-nuxt-directus/app/components/todo/TodoEditForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ updateTodo.$onSaved(() => emit('close'))
1818
:state="updateTodo"
1919
:schema="updateTodo.$schema"
2020
class="flex flex-col gap-4"
21-
@submit="updateTodo.$save()"
21+
@submit="updateTodo.$submit()"
2222
>
2323
<UFormField
2424
label="Text"

packages/playground/app/components/todo/TodoEditForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ updateTodo.$onSaved(() => emit('close'))
1818
:state="updateTodo"
1919
:schema="updateTodo.$schema"
2020
class="flex flex-col gap-4"
21-
@submit="updateTodo.$save()"
21+
@submit="updateTodo.$submit()"
2222
>
2323
<UFormField
2424
label="Text"

packages/playground/app/pages/chat.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ createChatMessage.$onSaved(() => {
2727
placeholder="Type your message here..."
2828
icon="lucide:message-circle"
2929
autofocus
30-
@keyup.enter="createChatMessage.$save()"
30+
@keyup.enter="createChatMessage.$submit()"
3131
/>
3232

3333
<div class="flex-1 min-h-0 overflow-y-auto flex flex-col gap-2">

0 commit comments

Comments
 (0)