From 901b918dbba9ece9255ff6a947793bc8cb5ee427 Mon Sep 17 00:00:00 2001 From: Sebastian Frank Date: Tue, 29 Aug 2017 21:12:27 +0200 Subject: [PATCH] form validate css --- src/components/my-form.vue | 13 ++++--------- src/components/my-input.vue | 19 ++++++++++++++++--- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/components/my-form.vue b/src/components/my-form.vue index cbaf8ef..7f7ba2a 100644 --- a/src/components/my-form.vue +++ b/src/components/my-form.vue @@ -8,9 +8,10 @@ :placeholder="item.placeholder" :type="item.type" v-model="formData[key]" - @validate="validateData(key)"> + @validate="validateData(key)" + :invalid="formErrors[key]" + > - required
@@ -85,10 +86,4 @@ export default { } } } - - - \ No newline at end of file + \ No newline at end of file diff --git a/src/components/my-input.vue b/src/components/my-input.vue index edd385b..23a2b5c 100644 --- a/src/components/my-input.vue +++ b/src/components/my-input.vue @@ -9,16 +9,28 @@ :name="name" :placeholder="placeholder" @blur="validate()" - @change="() => $emit('change', currentValue)"> + @change="() => $emit('change', currentValue)" + :class="{invalid}" + > + @change="() => $emit('change', currentValue)" + :class="{invalid}" + >
+ + + +