Playing with scope in Vue 2.x
by asemahle
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.0.7/vue.js"></script>
<div id="app" v-cloak>
<button v-on:click="func1">CLICK ME</button>
</div>
JavaScript
function _func1(self) {
console.log(self.title, this);
self.func2();
}
var app = new Vue({
el: '#app',
data: {
title: 'Original Value',
},
methods: {
func1() {
console.log(this.title, this);
_func1(this)
},
func2() {
console.log(this.title, this);
}
}
})