Strategies for extending Vue.js : Comparisons of some common techniques.
MIXINS, COMPONENT EXTENSION, PLUGIN IN VUE
This tutorial will help you answer some questions, though some different examples and approaches, about how to add support for capturing mouse events that take place within the bounds of a Vue component.
Learn through five examples the benefits of each way and when to use which.
By the end you should have 5 implementations:
- Basic simply implements the pointer tracking directly in our component, as a baseline.
- Mixin uses a mixin to do the same as above.
- Extend uses component extension to inherit the functionality.
- Plugin extracts the functionality to an external file, making it available as a custom directive.
- Bonus shows off a lot more of what can be done with the plugin / custom directive combo.
To get the code for this tutorial head to the GitHub repo.
Take a look at this tutorial, here.