โ˜… Using global mixins in Vue.js

1 ยท Freek Van der Herten ยท Aug. 17, 2017, 9:35 a.m.
Recently I needed to add some global functionality to nearly all Vue components in an app. My colleague Seb told me a good way to achieve this: global mixins. In this post I'd like share that knowledge. In Vue a mixin is some functionality bundled in a file that can be added to one or more Vue components. It's very similar to a trait in PHP. Let's take a look at how such a regular mixin looks like. It's really nothing more than a .js with some stuff in it. Here's one with a computed property to ...