Let's get started with the installation of the v-mask library. In order for our project to use what it has to offer, we first need to add it to our project dependencies. Follow these steps in order to do this:
- Open up your Terminal and type in the following command to add the library to our dependencies:
> npm install v-mask
- We need to add it to Vue as a plugin, so head to main.js, and let's both import it and let Vue know that we want to register it as a plugin for all of our apps. Add the following code, after the import App line:
import VueMask from 'v-mask'
Vue.use(VueMask);
Now that we have registered our plugin, we have access to a new directive: v-mask. We can add this new directive directly onto our <input> elements, and the library will handle the masking behind the scenes by reading the user's input,...