You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var re =/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
146
162
returnre.test(email);
147
163
}
@@ -197,29 +213,36 @@ Note the set of inputs covering the five different features. Note the addition o
197
213
198
214
```js
199
215
constapp=newVue({
200
-
el:'#app',
216
+
el:'#app',
201
217
data:{
202
-
errors:[],
203
-
weapons:0,
204
-
shields:0,
205
-
coffee:0,
206
-
ac:0,
207
-
mousedroids:0
218
+
errors:[],
219
+
weapons:0,
220
+
shields:0,
221
+
coffee:0,
222
+
ac:0,
223
+
mousedroids:0
208
224
},
209
-
computed:{
210
-
total:function() {
211
-
// must parse cuz Vue turns empty value to string
212
-
returnNumber(this.weapons)+
213
-
Number(this.shields)+
214
-
Number(this.coffee)+
225
+
computed:{
226
+
total:function() {
227
+
// must parse because Vue turns empty value to string
228
+
returnNumber(this.weapons)+
229
+
Number(this.shields)+
230
+
Number(this.coffee)+
215
231
Number(this.ac+this.mousedroids);
216
232
}
217
233
},
218
234
methods:{
219
-
checkForm:function(e) {
235
+
checkForm:function(e) {
220
236
this.errors= [];
221
-
if(this.total!=100) this.errors.push("Total must be 100!");
222
-
if(!this.errors.length) returntrue;
237
+
238
+
if (this.total!=100) {
239
+
this.errors.push('Total must be 100!');
240
+
}
241
+
242
+
if (!this.errors.length) {
243
+
returntrue;
244
+
}
245
+
223
246
e.preventDefault();
224
247
}
225
248
}
@@ -237,16 +260,16 @@ In my final example, we built something that makes use of Ajax to validate at th
0 commit comments