harmony-database/README.md
2023-10-08 17:49:17 +08:00

518 B

Template

database

注意事项

  1. 由于constructor()函数不能异步,因此在其中调用getRdbStore() 函数时,不能保证新建对象后,数据库初始化完毕。那么此时如果调用insert等方法时,RdbStore可能还是undefined,导致数据库操作失败。

    因此,只能使用回调来处理。

  aboutToAppear() {
   this.todoTable.getRdbStore(async () => {
      const res = await this.todoTable.query();
      this.todoList = res;
   })
}