-
Hello, I'm currently learning Vue 3 and vee-validate. Our department uses a Vue 3 template with many useful components, and I've encountered a specific challenge I hope you can help with. I'm working on an input component that needs to dynamically update its validation rules based on props.rules received from a parent component. The rules look something like this:
The input component is defined as follows:
In the script setup, I'm using useField from vee-validate:
When the props.rules change (triggered by a button in the parent component), a watch confirms that the props.rules have updated. However, it appears that useField only acknowledges the initial props.rules and does not update when props.rules changes. I suspect there might be some Vue 3 or vee-validate nuances that I'm missing. Any insights or suggestions would be greatly appreciated. If additional code or context is required, I'm happy to provide it. Thank you in advance for your assistance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I got inspiration from #4578,and found solution like:
However, it's not working if you set computed variable instead of putting whole computed inside useFieldRules.
|
Beta Was this translation helpful? Give feedback.
I got inspiration from #4578,and found solution like:
However, it's not working if you set computed variable instead of putting whole computed inside useFieldRules.