Some popular Vue plugins are Vuex and Vue-router. A Vue plugin is used when we need to give additional functionality to Vue globally. There are a few very common scenarios where Vue plugins might be useful: adding global methods, adding global assets, adding instance methods on Vue.prototype
, or adding global mixins.
Where Vue plugins shine is the ability to share them with the community. To get an idea of the vastness of Vue's plugin system, navigate to the following URLs: https://github.com/vuejs/awesome-vue#components--libraries and https://vuejsexamples.com/.
Next, we'll create a simple Vue plugin.
We'll begin by creating the simplest possible Vue plugin. In order to do that, we'll again use Vue CLI, version 3. The instructions for setting up Vue CLI are available in Chapter 3, Working with Vue-CLI, Components, Props, and Slots.
First, we will need to initialize a new project. Navigate your console to the parent folder in...