LEARNING BY VUEING

Plugins
40 / 42

NPM has tons of plugins for you to use. Plugins can do anything from registering global components, directives, variables on the Vue instance, etc.

This example installs a validation engine, it gets registered in main.js with Vue.use.

In App.vue, the plugin lets us define rules under a new property validations. It also introduces a new variable $v.

This example puts a validation on the input field saying it is required and must be at least 5 characters long.