File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed
Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change 44 <label >Name</label >
55 <input v-model =" name" @keydown.ctrl.v.prevent =" blockPaste" >
66
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+
1111 <label >Rating</label >
1212 <select v-model.number =" rating" >
1313 <option disabled value =" " >select</option >
@@ -45,10 +45,18 @@ export default class ProductReview extends Vue {
4545 this .errors = [];
4646 if (! this .rating ) {
4747 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 ) {
4856 return ;
4957 }
5058
51- const review = {name: this .name , rating: this .rating }
59+ const review = {name: this .name , rating: this .rating };
5260 console .log (' Submitting' , review );
5361 this .$emit (' add-review' , review );
5462 }
7280}
7381
7482input :not ([type = checkbox ]) {
75- width : 100% ;
83+ width : 100% ;
7684 height : 25px ;
7785 margin-bottom : 10px ;
7886}
You can’t perform that action at this time.
0 commit comments