我无法理解这简单的事情。我需要将数据存储在数据库中,因此,按照 ionic 文档,我完全按照此页面的说明进行操作:
https://ionicframework.com/docs/storage/
我在网上读到 WebSQL 已被弃用,所以我想使用 IndexedDB 来存储数据。问题是使用 get/set 方法并运行“ionic serve”我看到数据存储在 WebSQL 中(以字符串的形式,很难看到像 IndexedDB 中的对象)。
我究竟做错了什么?如何存储在 IndexedDB 中,为什么比 WebSQL 更喜欢它?
最佳答案
来自文档
Configuring Storage
The Storage engine can be configured both with specific storage engine priorities, or custom configuration options to pass to localForage. See the localForage config docs for possible options: https://github.com/localForage/localForage#configuration
您必须正确传递订单。
IonicStorageModule.forRoot({
name: '__mydb',
driverOrder: ['indexeddb', 'sqlite', 'websql']
})
如果是这样删除sqlite
和 websql
然后再试一次
关于ionic-framework - 为什么我的数据保存在 WebSQL 而不是 IndexedDB 中? ( ionic ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49863459/