小编 Sw*_*amy的帖子

TransactionInactiveError:无法在'IDBObjectStore'上执行'add':事务处于非活动状态

在这段代码中,store1.add当我在控制台中查看它时,我遇到了问题TransactionInactiveError: Failed to execute 'add' on 'IDBObjectStore': The transaction is not active.

任何人帮助我,如果可能的话给出一些示例代码.

function indexInitialization(){

     var userDetails = indexedDB.open("dynamicServicess");

     userDetails.onupgradeneeded = function(e) {
         console.log("Upgrading...");
         var thisDB = e.target.result;
         var objectStore=thisDB.createObjectStore("servicess",{keyPath: "ID"});
         var objectStore2=thisDB.createObjectStore("businessareas",{keyPath: "ID"});
         var objectStore3=thisDB.createObjectStore("languages",{keyPath: "ID"});
         var objectStore4=thisDB.createObjectStore("rolenames",{keyPath: "ID"});
         objectStore2.createIndex("language", "LANGLOCALE", { unique: false });
         objectStore.createIndex("businessarea", "BUSINESSAREA", { unique: false });
     objectStore.createIndex("rolename", "ROLENAME", { unique: false });
     }

     userDetails.onsuccess = function(e) {
         console.log("Success!");
         db = e.target.result;
         indexedDbObjectCreation();

     }

     userDetails.onerror = function(e) {
         console.log("Error");      
         console.dir(e);
     } …
Run Code Online (Sandbox Code Playgroud)

indexeddb

3
推荐指数
2
解决办法
4413
查看次数

标签 统计

indexeddb ×1