【问题标题】:DexieJS how to get all from a table?Dexie JS如何从一个表中获取所有内容?
【发布时间】:2020-11-30 16:27:06
【问题描述】:

经过一周的搜索和尝试,我仍然找不到从表中获取所有记录的方法。我知道,请随时对我大喊大叫。但是该应用程序仍然必须运行,所以我必须解决它。我使用以下代码,我毫不怀疑这是最糟糕的方式。

db.table.orderBy('id').toArray().then( async result => {
  await result.reduce( (promise, item) => { 
    await promise;
    console.log(item);
    // coding here
  } );
});

是的,这是我的解决方法,讨厌我。我也讨厌自己。

请指教,提前谢谢

【问题讨论】:

    标签: dexie dexiejs


    【解决方案1】:

    你试过了吗

    db.table.toArray().then(items => console.log(items));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-08-04
      • 1970-01-01
      • 1970-01-01
      • 2020-12-04
      • 2014-10-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多