A form is a document for collecting information. The HTML <form> element is a form where the data or information can be collected from the web user. This element requires <input> elements in it to specify what data we want to collect. But before accepting the data, we usually would want to validate and filter it so that we get genuine and correct data from the user.
Vue allows us to validate the data easily from the v-model input elements, so let's get started with a single-file components (SFC) Vue app and webpack, which you learned about in Chapter 5, Adding Vue Components, in the Compiling single-file components with webpack section. First, we will create a very simple form with a submit button and the markups for displaying the error message in the <template> block as follows:
// src/components/basic.vue
<form v-on:submit.prevent="checkForm" action="/" method="post">
<p v-if="...