Vue3 Vee Validate Import Custom Global Rules Issue #3426
-
|
Hi folks, I want to define some rules in a seperate js file using defineRule in new vee validate. I imported that file into main.js but my sub components cant recognize those rules. I added that line to 'main.js' This is my validation.js Sample component for test purposes This is the warning that i get Do you have any idea about solving that problem? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
|
You have bound the So either: <Field name="field" class="bg-gray-300 text-white" rules="required" />or This: <Field name="field" class="bg-gray-300 text-white" :rules="'required'" /> |
Beta Was this translation helpful? Give feedback.
-
|
@logaretm i see how it mentions putting them in main.js... is there any way to include these any other way? is there a reason it cant just be a reactive object like normal? App load time is extremely important to my app so im concerned about importing the subset i need into main.js |
Beta Was this translation helpful? Give feedback.
-
|
@logaretm I am struggling a bit using this syntax in an external library where i save my global rules, i am exporting them as function without the defineRule but i don't think that's they right way of using them. |
Beta Was this translation helpful? Give feedback.
You have bound the
rulesprop to non-existingrequiredproperty which is a common mistake, you need to passrequiredas a stringSo either:
<Field name="field" class="bg-gray-300 text-white" rules="required" />or This: