Let's start by installing Vuelidate in our project as a dependency, and then we are going to use it for validation. Follow these steps:
- Open up the Terminal and execute the following command:
> npm install vuelidate
Once the library has been installed, we have to import it into main.js and use it as a plugin, so that it is globally available to all our components.
- Add the following code to main.js, after the code that imports Vue and App:
import Vuelidate from 'vuelidate';
Vue.use(Vuelidate);
Now that Vuelidate has been installed and is now part of our project dependencies, we are ready to make it do some of the heavy lifting. In the next section, we are going to create our validation rules.