1、vue组件或者实例中,this代表调用它的Vue实例;
2、回调函数中,this代表父级组件;
3、箭头函数中,this代表定义它时所处的对象;
Vue 中回调函数中的 this:
若回调函数为匿名函数,非严格模式下指向 window,严格模式下为 undefined。
若回调函数为自定义方法,则 this 指向 Vue 实例。
若回调函数为 箭头函数,则 this 指向 Vue 实例。
3. Vue 中 addEventListener 中的 this
Vue 中 addEventListener 中的 this
通常,事件监听函数中的 this 都指向绑定事件的那个元素, 但是在 Vue 中,监听函数中的 this 也指向 Vue 实例
let that = this;
在Vue中this始终指向Vue,但一些其他组件如axios中this为undefined,通过let that = this将this保存在that中,再在函数中使用that均可 。