-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
46 lines (39 loc) · 824 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
var app = new Vue({
el: '#form1',
data: function () {
return {
email : "",
emailBlured : false,
valid : false,
submitted : false,
password:"",
passwordBlured:false
}
},
methods:{
validate : function(){
this.emailBlured = true;
this.passwordBlured = true;
if( this.validEmail(this.email) && this.validPassword(this.password)){
this.valid = true;
}
},
validEmail : function(email) {
var re = /(.+)@(.+){2,}\.(.+){2,}/;
if(re.test(email.toLowerCase())){
return true;
}
},
validPassword : function(password) {
if (password.length > 7) {
return true;
}
},
submit : function(){
this.validate();
if(this.valid){
this.submitted = true;
}
}
}
});