组件中的函数的两种不同写法为什么会导致this指针的指向不同?
在component.js中
Component({ attached:()=>{ console.log(this) // undefined}}) |
但是
Component({ attached: function() { console.log(this) // 指向当前Component}}) |
有大神知道为什么嘛
在component.js中
Component({ attached:()=>{ console.log(this) // undefined}}) |
但是
Component({ attached: function() { console.log(this) // 指向当前Component}}) |
有大神知道为什么嘛