Create a Quick Prototype in Vue — Part 4

In the previous step, we started working on the UserForm component. In this step, we’ll continue to work on it by adding input validation, and emitting an event to the parent (rootComponent) when a user has been updated.

Update the handleSubmit method in the UserForm component to look like this:

handleSubmit(){
if (this.validate()) {
this.$emit("user-edited", this.user);
}
}

Note that we have not yet defined the validate() method, we’ll do that in just a minute. The validate() method will…