美文网首页
微信小程序开发过程中的记录

微信小程序开发过程中的记录

作者: iStig | 来源:发表于2017-07-06 21:06 被阅读12次
  1. javascript that&&this
    我的理解:参考这微信小程序 this和that详解及简单实例
    我最粗浅的理解是that是this的一个分身。当在某些情况下,比如request请求中this可能会被其他地方引用改动。而that会保持当下赋值的this内容。所以可以用that来接收参数变化。
    Javascript中object的this和that
    JavaScript中知而不全的this

  2. 碰到这种写法 list.push(...diaries.diaries)
    es6 ...语法糖

3.箭头语法 =>
this.getLocalDiaries(storage => {
for (var k in storage) {
list.push(storage[k]);
}
that.globalData.diaryList = list;
typeof cb == 'function' && cb(that.globalData.diaryList)
});

=>是es6语法中的arrow function

相关文章

网友评论

      本文标题:微信小程序开发过程中的记录

      本文链接:https://www.haomeiwen.com/subject/nbjkhxtx.html