Skip to content

Commit b4c3870

Browse files
committed
Docs: show where to use Vuelidate
Closes #405
1 parent a072577 commit b4c3870

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

docs/feathers-vuex-forms.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ Next let's look at a minimal example of a 'TodoEditor' component which is a chil
247247
248248
```vue
249249
<template>
250-
<form @submit.prevent="$emit('save')">
250+
<form @submit.prevent="handleSubmit">
251251
<input type="checkbox" v-model="item.isComplete" />
252252
<input type="text" v-model="item.description" />
253253
@@ -270,6 +270,19 @@ export default {
270270
type: Object,
271271
required: true
272272
}
273+
},
274+
setup(props, context) {
275+
function handleSubmit() {
276+
// This is a placeholder for checking form validity, (with Vuelidate, for example)
277+
const isValid = true || false
278+
279+
if (formIsValid) {
280+
context.emit('save')
281+
} else {
282+
// Show any form errors in the UI.
283+
}
284+
}
285+
return { handleSubmit }
273286
}
274287
}
275288
</script>

0 commit comments

Comments
 (0)