0

尝试编写正则表达式以匹配 UUID - 在线使用验证器能够成功证明正则表达式应该有效,但是,vee-validate 仍然将其标记为错误......有什么想法吗?

<form @submit.prevent="performSearch">
    <div class="msg-box">
        <validation-provider v-slot="{ errors }" rules="regex: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i">
            <input v-model="appliance...." name="id" class="search-param" placeholder="Full ..." />
            <span class="has-text-danger has-text-weight-bold is-size-8 msg">{{ errors[0] ? 'Pleas...' : '' }}</span>
        </validation-provider>
    </div>
    <button type="submit" class="button is-info">
        Filter
    </button>
    <button @click.prevent="clearSearch()" class="button is-light">Reset</button>
</form>
4

1 回答 1

0

rulesprop 不应该是字符串。尝试这个:

<ValidationProvider
      :rules="{
        regex: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,
      }"
      class="MyClass"
      tag="div"
      style="width: 50%"
>
于 2021-10-01T20:46:19.127 回答