Ionic capacitor Sqlite源码可以在github上查看https://github.com/capacitor-community/sqlite,目前中文的资料比较少,以前主要是Cordova的Sqlite,capacitor比较新,不过好在github上的资料也还算比较全面
capacitor 的Sqlite支持Android, iOS, Web和Electron,在web平台测试了一下,生成的的数据库可以在chrome下开发工具里面查看,在Application(应用)栏,Storage, IndexedDB, jeepSqliteStore
运行(await this.sqliteConnection.checkConnectionsConsistency()).result之前要先运行 await this.sqliteConnection.initWebStore();
否则console中可以看到报了以下错误
node_modules_capacit…ist_esm_web_js.js:2 ERROR
Error: The jeep-sqlite element is not present in the DOM! Please check the @capacitor-community/sqlite documentation for instructions regarding the web platform.
at CapacitorSQLiteWeb.ensureJeepSqliteIsAvailable (web.js:418:19)
at web.js:115:14
at Generator.next (<anonymous>)
at asyncGeneratorStep (asyncToGenerator.js:3:1)
at _next (asyncToGenerator.js:22:1)
at asyncToGenerator.js:27:1
at new ZoneAwarePromise (zone.js:1425:21)
at asyncToGenerator.js:19:1
at CapacitorSQLiteWeb.checkConnectionsConsistency (web.js:122:10)
at index.js:197:35