O'Reilly logo

Getting to Know Vue.js: Learn to Build Single Page Applications in Vue from Scratch by Brett Nelson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

© Brett Nelson 2018
Brett NelsonGetting to Know Vue.jshttps://doi.org/10.1007/978-1-4842-3781-6_9

9. Reusable Code

Brett Nelson1 
(1)
Eagan, Minnesota, USA
 

Components are great for reusing an entire custom element, but we can’t use just a portion of the component. To share functionality among multiple components, we have to use mixins. Custom directives will allow us to build out functionality that we can apply to standard HTML components and custom Vue.js components. The render function will give us more control over how our template is built, giving us the ability to use logic in JavaScript to build our templates.

Mixins

Mixins allow us to create “base” components with common functionality that we want to share with multiple components. This can ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required