草庐IT

createObjectStore

全部标签

javascript - 如何在 IndexedDB 中创建多个对象存储

不知道我说的对不对。但据我所知,我无法手动创建版本更改交易。调用它的唯一方法是在打开索引数据库连接时更改版本号。如果这是正确的,在example1和example2中永远不会创建新的objectStore?例子1functioncreateObjectStore(name){varrequest2=indexedDB.open("existingDB");request2.onupgradeneeded=function(){vardb=request2.result;varstore=db.createObjectStore(name);};}例子2functioncreateObj