vee-validate: v-validate does not work with JSX.

Versions

  • vee-validate: 2.1.4
  • vue: 2.5.19

Describe the bug v-model does not work when JSX is used. This was debugged by Vue core developers to be down to the use of model.expression.

More info is here: https://github.com/vuejs/jsx/issues/20

To reproduce Steps to reproduce the behavior: Do you have a JSX codepen?

Expected behavior v-model should bind and v-validate should work as expected.

Demo link TBA

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (16 by maintainers)

Most upvoted comments

The observer does not actually hold any messages on its own, its errors slot prop is a computed prop that collects all errors from child providers, so mutating it is not useful. Same thing for all the flags provided in its slot props.

The same case is for the validate and reset. They are shortcut methods that conveniently call the validate and reset methods on each child provider, also tidies up the result in a single promise so you do have to do it manually for each provider. You can think of the ValidationObserver, as a … well, an observer. It does not have state, and it doesn’t do anything the Providers cannot do on their own.

Still, you could access the errors on the ctx computed prop.

// this is an object containing error arrays for each provider.
this.$refs.observer.ctx.errors

@DM2489 yep, just add a ref to the provider and push your errors on the messages array, there is no errors prop.

this.$refs.nameVProvider.messages.push('error string here.');