Vue.prototype.bus=new Vue ();
Vue.component("child",{
template:`<div @click="handleClick">{{text}}</div>`,
props:{
content:[String,Number]
},
data(){
return {
text:this.content
}
},
methods:{
handleClick(){
this.bus.$emit("change",this.text)
}
},
mounted(){
var _this=this
console.log(_this);
this.bus.$on("change",function (msg) {
_this.text=msg
console.log(this);
})
}
})
var vm = new Vue({
el:"-sharpapp",
})
this.bus.$on in the above code ("change",function (msg) {
) _this.text=msg
console.log(this);
})
}
Who does the this in the callback function in point to? I hope the boss can help me with the answer. Thank you
.