Reputation: 67
The function validEmail throws the following error. "error 'validEmail' is not defined"
<script>
export default {
data() {
return {
accountEmail: "",
accountEmailVerify: ""
};
},
methods: {
validateEmail() {
validEmail(this.accountEmail);
},
validEmail(email) {
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,}))$/;
return re.test(email);
}
}
};
</script>
Upvotes: 0
Views: 46
Reputation: 1
You have to use this
to refer to your component instance in order to access that method :
methods: {
validateEmail() {
this.validEmail(this.accountEmail);
},
validEmail(email) {
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,}))$/;
return re.test(email);
}
}
Upvotes: 1