一般情况下 this 最终指向的是哪个调用他的对象
1. 全局作用域或者普通函数中 this 指向的是全局对象 window,(定时器里面的 this 指向 window)
2. 方法调用中谁调用 this 指向谁
3. 构造函数中 this 指向构造函数的实例对象
4. 箭头函数中 this 是静态的,this 始终指向函数声明时所在作用域下的 this 的值,简单来说,箭头函数中的 this 会向外去找
5. vm 中的 this 指向的是 Vue 的实例对象
一般情况下 this 最终指向的是哪个调用他的对象
1. 全局作用域或者普通函数中 this 指向的是全局对象 window,(定时器里面的 this 指向 window)
2. 方法调用中谁调用 this 指向谁
3. 构造函数中 this 指向构造函数的实例对象
4. 箭头函数中 this 是静态的,this 始终指向函数声明时所在作用域下的 this 的值,简单来说,箭头函数中的 this 会向外去找
5. vm 中的 this 指向的是 Vue 的实例对象