Learning Vuejs 2 - JSFiddle
Second tutorial code for Learning Vue JS
HTML
<script src="https://vuejs.org/js/vue.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.28/vue.min.js"></script>
<div id='vue-app'>
<cmp></cmp>
</div>
JavaScript
const mixin = {
methods: {
hello() {
return 'Hello World!';
}
},
created() {
console.log('Mixin Created!');
},
};
const cmp = {
created() {
console.log('From Cmp:', this.hello());
},
};
new Vue({
components: {
cmp
},
el: '#vue-app',
mixins: [mixin],
created() {
console.log('From VM:', this.hello());
},
});