1, the callback function, the change in the scope of this function by arrows
Success: (RES) => { this.setData ({// At this time, this point to page the page ... }) }
2, custom events, if you use the arrow functions, the arrow points to the function of this undefined, does not point to page
onLike: (event)=>{ likeModel.like(this.data.classic.id) //报错,this指向undefined },
We need to be modified to form a traditional function
onLike: function (Event) { likeModel.like (this.data.classic.id) // In this case, point to the this page page, no error },