vue.js - 消息中未打印导入规则的参数 (min_value) - Vee-Validate/Vuetify
问题描述
我正在使用带有 Vee-Validate 的 Vuetify。我在我的组件中导入 vee-validate 和规则:
import { ValidationProvider, extend } from 'vee-validate';
import { min_value } from 'vee-validate/dist/rules';
extend('min_value', {
...min_value,
message: "Must be higher than {length}"
});
然后我有以下内容template
:
<ValidationProvider :rules="`min_value:${obj.min[selectedUnit]}`" v-slot="{ errors }">
<v-text-field
v-model="obj.value[selectedUnit]"
:label="key"
ref="key"
:min="obj.min[selectedUnit]"
:max="obj.max[selectedUnit]"
:error-messages="errors"
:suffix="selectedUnit"
outlined
required
type="number"
></v-text-field>
</ValidationProvider>
该规则有效,但{length}
参数未转换为数字。
最后,在文档中它说min_value
是推断的。rules
但是当我不提供道具时它根本不起作用。来源https://logaretm.github.io/vee-validate/guide/rules.html#rules
解决方案
发现问题了!
参数被调用min
并且可以在文档中找到..
extend('min_value', {
...min_value,
message: "Must be higher than {min}"
});
推荐阅读
- xml - 在 PostgreSQL 中动态处理 XML 属性
- django - 电子邮件服务器在附加到 django 的 postgresql 上运行 sql 查询
- python - 如何获取在 cdk 脚本中创建的资源的 Arn
- javascript - 提交表格或发布请求后错过匹配日期
- elasticsearch - 如何在 elasticsearch dsl 查询中使用 kibana 可视化查询?
- java - 如果它是空/假,如何告诉杰克逊忽略布尔值?
- android - 带有 Firestore 云消息传递的 getIntent() 未显示键值数据
- microsoft-teams - 将文件复制到用户配置文件
- r - 在循环中根据行名合并列表数据
- python - 无法使用 import mysql.connector ,已成功安装 Connector/Python for MySQL