Versions
Describe the bug
Injection of validators using inject: ['$validator'] won't work when child component is nested in v-card or v-form tag. The parent provides $validator, but instead of getting the parent validator, a new one will be injected. If you provide the validator using another name everything works fine, so something is broken with $validator in combination with vuetify.
I don't know if this bug belongs to vuetify or vee-validate. I have submitted this issue here, because functionality of vee-validate is broken in this case, maybe I can get some advice what went wrong. Maybe I'm missing something ...
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Injection of $validator should work in child components
Demo Link
jsfiddle Demo
It actually works, v-card gets its own validator instance. And that the default behavior. But any children of v-card will inject that validator. So you don't get the one you are expecting so there are two validator instances here, the one on the root and the one on the v-card component.
You could provide inject: false to the plugin config to prevent validator instances from being injected to all components.
I get stuck on this one for 1 day. Is there any reason for v-card to have this kind of behavior?
@cwhsu1984 This is not related to a specific component, its how the Vue rendering works with slots.
Most helpful comment
It actually works,
v-cardgets its own validator instance. And that the default behavior. But any children ofv-cardwill inject that validator. So you don't get the one you are expecting so there are two validator instances here, the one on the root and the one on thev-cardcomponent.You could provide
inject: falseto the plugin config to prevent validator instances from being injected to all components.https://jsfiddle.net/zoLgpe46/1/