您好,我正在尝试使用 Vuelidate 验证输入,我在其他帖子中看到过,但这只是关于文本输入的问题,但我需要选择输入验证,我的代码是:
\n网页代码:
\n<div class="form-group">\n <label for="exampleInputEmail1">Tipo de Caja</label>\n <select class="form-control" \n v-model="$v.form.cashier_type_id.$model"\n :class="{\n 'is-valid':!$v.form.cashier_type_id.$error && $v.form.serie.$dirty,\n 'is-invalid':$v.form.cashier_type_id.$error && $v.form.serie.$dirty\n }"\n id="exampleFormControlSelect1">\n <option value="">- Seleccione -</option>\n <option value="2">Autom\xc3\xa1tica</option>\n <option value="3">Electr\xc3\xb3nica</option>\n <option value="1">Manual</option>\n </select>\n</div>\nRun Code Online (Sandbox Code Playgroud)\n我的Vue代码:
\n validations: {\n form: {\n name: {\n required,\n minLength: minLength(2)\n },\n serie: {\n required,\n minLength: minLength(2)\n },\n cashier_type_id: {\n required\n }\n }\n }\nRun Code Online (Sandbox Code Playgroud)\n我添加了必需的,但问题是当我选择该选项时它不会将颜色更改为绿色,所以我想知道如何进行验证?
\n谢谢
\n您好,我正在尝试验证文件输入是否不为空,所以我这样做:
我的 HTML 代码:
<input accept="image/jpeg, image/png, image/gif" type="file" class="form-control" v-on:change="onFileChange">
Run Code Online (Sandbox Code Playgroud)
我正在按钮中进行验证:
<button
:disabled="I need to know what it'll be here ? !isDisabled : isDisabled"
type="submit"
class="btn btn-success btn-icon-split">
<span class="icon text-white-50">
<i class="fas fa-check"></i>
</span>
<span class="text">Guardar</span>
</button>
Run Code Online (Sandbox Code Playgroud)
但我不知道该怎么做,因为它没有 v-model 并且我不知道如何检查它是否为空。我怎么能这么做呢?
谢谢