This repository was archived by the owner on Nov 30, 2020. It is now read-only.
File tree 2 files changed +21
-5
lines changed
2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change 35
35
</form-group >
36
36
<form-group >
37
37
<form-label >Valid State</form-label >
38
- <form-input placeholder =" Valid State.." />
39
- <form-input class =" mt-3" placeholder =" Valid State.. " />
38
+ <form-input valid placeholder =" Valid State.." />
39
+ <form-input tick class =" mt-3" value =" Valid state " />
40
40
</form-group >
41
41
<form-group >
42
42
<form-label >Invalid State</form-label >
43
- <form-input placeholder =" Invalid State.." />
44
- <form-input class =" mt-3" placeholder =" Invalid State.." />
43
+ <form-input invalid placeholder =" Invalid State.." />
44
+ <div class =" invalid-feedback" >Invalid feedback</div >
45
+ <form-input cross class =" mt-3" value =" Invalid state" />
45
46
</form-group >
46
47
<form-group >
47
48
<form-label >Country</form-label >
Original file line number Diff line number Diff line change 1
1
<template >
2
- <input class =" form-control" v-model =" internalValue" @input =" onInput" >
2
+ <input class =" form-control" :class = " className " v-model =" internalValue" @input =" onInput" >
3
3
</template >
4
4
5
5
<script >
6
6
export default {
7
7
name: " form-input" ,
8
8
props: {
9
9
value: {},
10
+ invalid: { default: false , type: Boolean },
11
+ valid: { default: false , type: Boolean },
12
+ tick: {default: false , type: Boolean },
13
+ cross: {default: false , type: Boolean }
10
14
},
11
15
12
16
data : () => ({
13
17
internalValue: null
14
18
}),
15
19
20
+ computed: {
21
+ className () {
22
+ const className = {}
23
+ className[' is-valid' ] = this .valid
24
+ className[' state-valid' ] = this .tick
25
+ className[' is-invalid' ] = this .invalid
26
+ className[' state-invalid' ] = this .cross
27
+ return className
28
+ }
29
+ },
30
+
16
31
methods: {
17
32
onInput () {
18
33
this .$emit (' input' , this .internalValue )
You can’t perform that action at this time.
0 commit comments