js中的this

1.this一般指代函数被调用时的对象

2.构造函数var a=new A(),new 的过程中其实把this指向了a

  特殊情况:当构造函数return一个对象时 this指向那个对象  null除外  因为null比较特殊

3.箭头函数 this指向当前环境的this

   所以vue中settimeout内一般用箭头函数

4.改变this指向可以用call,apply,bind

posted @ 2019-01-21 14:16  lihangdeboke  阅读(91)  评论(0编辑  收藏  举报