this
this是call()的第一个参数

箭头函数=>里没有this(不会改变this,this永远指向window)

在箭头函数出来前,可以用一个变量如self在函数执行前接受this,然后用self.onClick()

有了箭头函数,可以这样写

箭头函数=>里没有this(不会改变this,this永远指向window)
在箭头函数出来前,可以用一个变量如self在函数执行前接受this,然后用self.onClick()
有了箭头函数,可以这样写
本文标题:this与箭头函数
本文链接:https://www.haomeiwen.com/subject/ydxbhqtx.html
网友评论