You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/feathers-vuex-forms.md
+140Lines changed: 140 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -288,6 +288,146 @@ export default {
288
288
</script>
289
289
```
290
290
291
+
### Vuelidate 2 Example
292
+
293
+
Here's an example of how you might use the upcoming Vuelidate 2 (which is being rewritten to work with the Vue Composition API) to do form validation. Just to be clear, the validation library you use doesn't change how FeathersVuex will work. Since Vuelidate is likely the most popular validation library, this is an example to get you started. There may be some things to figure out to implement your use case. First, you'll need to install these dependencies:
294
+
295
+
```json
296
+
{
297
+
"dependencies": {
298
+
"@vuelidate/core": "^2.0.0-alpha.0",
299
+
"@vuelidate/validators": "^2.0.0-alpha.0"
300
+
}
301
+
}
302
+
```
303
+
304
+
Here's the full example, complete with TailwindCSS styles.
if (!$v.$invalid) context.emit('create', { org, accessType })
399
+
400
+
selectedOrg.value = null
401
+
selectedAccessType.value = 'view'
402
+
403
+
// Not currently working, so the org select turns red after removal
404
+
$v.org.$reset()
405
+
}
406
+
407
+
function makeOrgLabel(org) {
408
+
let label = `${org.name}`
409
+
if (org.nameOfOwner) {
410
+
label += ` (${org.nameOfOwner})`
411
+
}
412
+
return label
413
+
}
414
+
415
+
return {
416
+
selectedOrg,
417
+
selectedAccessType,
418
+
filteredOrgs,
419
+
validateAndCreate,
420
+
capitalize,
421
+
$v,
422
+
makeOrgLabel
423
+
}
424
+
}
425
+
}
426
+
</script>
427
+
428
+
<style lang="postcss"></style>
429
+
```
430
+
291
431
## FeathersVuexInputWrapper
292
432
293
433
Building on the same ideas as the FeathersVuexFormWrapper, the FeathersVuexInputWrapper reduces boilerplate for working with the clone and commit pattern on a single input. One use case for this component is implementing an "edit-in-place" workflow. The following example shows how to use the FeathersVuexInputWrapper to automatically save a record upon `blur` on a text input:
0 commit comments