JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://unpkg.com/vue@2.2.1/dist/vue.js"></script>
<div id="app">
<my-comp :has-timer="true"></my-comp>
</div>
JavaScript
var timerMixin = {
created(){
if(this.hasTimer){
this.initTimer();
}
},
methods: {
initTimer(){
console.log('Init Timer Mixin')
}
}
}
Vue.component('my-comp', {
template: `<div></div>`,
mixins: [timerMixin],
props: ['hasTimer']
});
var vm = new Vue({
el: "#app"
});