File tree 1 file changed +14
-6
lines changed
1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change 4
4
<label >Name</label >
5
5
<input v-model =" name" @keydown.ctrl.v.prevent =" blockPaste" >
6
6
7
- <div class =" error" v-for =" error in errors" :key =" error" >
8
- * {{ error }}
9
- </div >
10
-
7
+ <ul class =" error" v-for =" error in errors" :key =" error" >
8
+ < li >{{ error}}</ li >
9
+ </ul >
10
+
11
11
<label >Rating</label >
12
12
<select v-model.number =" rating" >
13
13
<option disabled value =" " >select</option >
@@ -45,10 +45,18 @@ export default class ProductReview extends Vue {
45
45
this .errors = [];
46
46
if (! this .rating ) {
47
47
this .errors .push (' Please select a rating' );
48
+ }
49
+ if (! this .name ) {
50
+ this .errors .push (' Please provide your name' );
51
+ }
52
+ if (! this .acceptTerms ) {
53
+ this .errors .push (' Please accept the terms' );
54
+ }
55
+ if (this .errors .length ) {
48
56
return ;
49
57
}
50
58
51
- const review = {name: this .name , rating: this .rating }
59
+ const review = {name: this .name , rating: this .rating };
52
60
console .log (' Submitting' , review );
53
61
this .$emit (' add-review' , review );
54
62
}
72
80
}
73
81
74
82
input:not([type=checkbox]) {
75
- width: 100%;
83
+ width: 100%;
76
84
height: 25px;
77
85
margin-bottom: 10px;
78
86
}
You can’t perform that action at this time.
0 commit comments