logaretm / vee-validate

✅ Painless Vue forms
https://vee-validate.logaretm.com/v4
MIT License
10.79k stars 1.26k forks source link

Update the Pinia store example #4646

Closed Warhead5555 closed 8 months ago

Warhead5555 commented 9 months ago

The Pinia store example seems to be outdated as it still uses defineInputBinds instead of the new defineField. The example can be found here: https://vee-validate.logaretm.com/v4/examples/using-stores/

Please provide the correct way to expose the ref value and attrs binding (via array destructuring) in the return object from the store.

How do I use the vee-validate field in my component? I have a few ideas on how to implement it, but some of them don't seem to work due to destructuring and potential loss of reactivity (I think). It also becomes very tedious to expose the ref and attrs values separately for each field.

Here are some implementations I came up with:

<input v-model='myValue' v-bind='myValueAttrs'>

Or

<input v-model='myStore.myValue' v-bind='myStore.myValueAttrs'>

Or

<input v-model='myStore.myValueField[0]' v-bind='myStore.myValueField[1]'>

logaretm commented 8 months ago

Thanks for the heads up! should be updated now!