Error reporting in new form.

This commit is contained in:
James Cole
2019-05-24 05:29:04 +02:00
parent 695244c928
commit 8f1928c933
18 changed files with 2151 additions and 814 deletions

View File

@@ -1,5 +1,7 @@
<template>
<div class="form-group">
<div class="form-group"
v-bind:class="{ 'has-error': hasError()}"
>
<div class="col-sm-12 text-sm">
{{ title }}
</div>
@@ -9,6 +11,9 @@
ref="str"
:value="value" @input="handleInput"
:placeholder="title">
<ul class="list-unstyled" v-for="error in this.error">
<li class="text-danger">{{ error }}</li>
</ul>
</div>
</div>
</template>
@@ -19,11 +24,15 @@
props: {
title: String,
name: String,
value: String
value: String,
error: Array
},
methods: {
handleInput(e) {
this.$emit('input', this.$refs.str.value);
},
hasError: function () {
return this.error.length > 0;
}
}
}