vee-validate icon indicating copy to clipboard operation
vee-validate copied to clipboard

Global and local rules cannot be combined

Open binairo opened this issue 9 months ago • 0 comments

What happened?

I'm trying to use global and local rules together like this:

<Field
  :rules="{
    required: true,
    myLocalRule    
  }"
/>

But I get the error Error: No such validator 'myLocalRule' exists.

However, if I just use it like this:

<Field
  :rules="myLocalRule"
/>

It works fine.

I've also tried the array syntax:

<Field
  :rules="[
    'required',
    myLocalRule    
  ]"
/>

But that gives the error TypeError: rule is not a function

This might be related to the discussion here: https://github.com/logaretm/vee-validate/discussions/4705 and this issue https://github.com/logaretm/vee-validate/issues/4058 (which is closed but seems like it's still not working?)

binairo avatar Apr 16 '25 12:04 binairo