问题描述
在下面的代码中,如果存在验证规则(如数字,但不需要),我尝试实现验证。如果规则为“数字”,则验证码不起作用,但如果规则为“数字|必需”,则验证码起作用。
我在github上阅读了此问题 https://github.com/logaretm/vee-validate/issues/383 但这似乎不起作用。
尝试1-
<template>
<ValidationProvider
ref="totalquantity"
name="Stock Total Quantity"
rules="numeric"
>
<v-text-field
v-model.number="item"
slot-scope="{
errors,valid,}"
clearable
dense
:error-messages="errors"
:success="valid"
label="Item*"
type="number"
outlined
/>
</ValidationProvider>
</template>
<script>
import { ValidationProvider,extend } from 'vee-validate'
import { required,numeric,regex,integer } from 'vee-validate/dist/rules'
extend('required',required)
extend('numeric',numeric)
extend('regex',regex)
extend('integer',integer)
</script>
尝试2-
:rules="edititem.percustomerqty?'required|numeric':''"
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)