vee 验证导入规则获取参数
vee validate import rules getting parmeter
我想获取以下代码的错误消息中的最小参数
extend('min', { ...min, message: 'The {_field_} field must have at least {_min_} characters'})
当字段无效时,不返回 _min_
变量参数。我如何访问该参数
您面临两个问题。
最小规则使用length
而不是min
作为参数名称(reference)
参数字段未被下划线包围 - 按照 the documentation - 见下文:
One thing to note is that the parameter placeholder doesn't have underscores _
around it unlike the {_field_}
placeholder. This is a convention of vee-validate as there are special set of placeholders that have underscores around them. This is to prevent collisions and to make them distinct from rule parameters.
因此对于您的代码:
extend('min', {
...min,
message: 'The {_field_} field must have at least {length} characters'
})
我想获取以下代码的错误消息中的最小参数
extend('min', { ...min, message: 'The {_field_} field must have at least {_min_} characters'})
当字段无效时,不返回 _min_
变量参数。我如何访问该参数
您面临两个问题。
最小规则使用
length
而不是min
作为参数名称(reference)参数字段未被下划线包围 - 按照 the documentation - 见下文:
One thing to note is that the parameter placeholder doesn't have underscores
_
around it unlike the{_field_}
placeholder. This is a convention of vee-validate as there are special set of placeholders that have underscores around them. This is to prevent collisions and to make them distinct from rule parameters.
因此对于您的代码:
extend('min', {
...min,
message: 'The {_field_} field must have at least {length} characters'
})