indexDB1.html:45 Uncaught DOMException: Failed to execute ‘add‘ on ‘IDBObjectStore‘: The object sto
最近在学习 IndexedBD 的时候报了以下的错误
Failed to execute 'add' on 'IDBObjectStore':
源码 就这么一小段,一开始是没有添加主键 {autoIncrement: true}
但是添加后还是报错,怀疑是浏览器缓存的问题,就把浏览器中 创建的数据库给删除了,更改版本号,重新创建
完美解决
源码截图
总结:在创建IndexedBD 数据库的时候,很容易有缓存和版本的问题,可以删除从建或是更新版本号