消息中未打印导入规则 (min_value) 上的参数 - Vee-Validate/Vuetify

Con*_*s N 3 vue.js vuetify.js vee-validate

我正在使用 Vuetify 和 Vee-Validate。我在我的组件中导入 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}"
});
Run Code Online (Sandbox Code Playgroud)

然后我有以下内容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>
Run Code Online (Sandbox Code Playgroud)

该规则有效,但{length}参数未转换为数字。

在此处输入图片说明

最后,在文档中它说min_value是推断的。但是当我不提供rules道具时它根本不起作用。来源https://logaretm.github.io/vee-validate/guide/rules.html#rules

Con*_*s N 5

Found the problem!

The param is called min and can be found in the docs..

extend('min_value', {
    ...min_value,
    message: "Must be higher than {min}"
});
Run Code Online (Sandbox Code Playgroud)