隆重介绍 LeanCloud JavaScript 存储 SDK v3.0.0 的第一个 beta 版本。文档79 的下载地址已更新到最新的公测版本。

在这个版本中,我们修复了在 include 了嵌套的字段的情况下,将 AV.Object 直接作为数据 setData 时,在 wxml 中无法访问嵌套对象的数据的问题。建议所有用户更新

我们认为设计良好的 SDK 用起来应该是符合直觉的。在这个版本中,我们重新设计了 AV.Object#toJSON 方法,现在在任何情况下,你都可以直接将构造或查询得到的 AV.ObjectAV.File 作为小程序页面的 data 来给视图层使用的。以 LeanTodo Demo37 为例:

// pages/todos/todos.js
Page({
  data: {
    todos: [],
  },
  onReady: function() {
    new AV.Query('Todo')
      .descending('createdAt')
      .find()
      .then(todos => this.setData({ todos })) // 直接将 AV.Object 作为 data set
      .catch(console.error);
  },
});

<!-- pages/todos/todos.wxml -->
<block wx:for="{{todos}}" wx:for-item="todo" wx:key="objectId">
  <text data-id="{{todo.objectId}}">
    <!-- 使用 `.` 访问 object 属性 -->
    {{todo.content}}
  </text>
</block>
3 人赞了这个帖子.

This topic is now pinned. It will appear at the top of its category until it is unpinned by staff for everyone, or by individual users for themselves.

This topic is now unlisted. It will no longer be displayed in any topic lists. The only way to access this topic is via direct link.

This topic is now listed. It will be displayed in topic lists.

非常好,之前开发中对于对象属性的访问方式有点混乱

希望一个后端 app 可以支持多个小程序登录,急需。

有更新日志吗