将数据插入到 React 本机 Sqlite DB 中的表中时出现以下错误
可能未处理的 Promise Rejection (id: 0): TypeError: plugin.warn is not a function TypeError: plugin.warn is not a function at SQLitePluginTransaction.addStatement (http://localhost:8081/index.bundle?platform=android&dev=true&minify =false:416247:18) 在 SQLitePluginTransaction.executeSql (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:416228:10) 在 http://localhost:8081/index.bundle?platform =android&dev=true&minify=false:415677:42 at tryCallTwo (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:27207:7) at doResolve (http://localhost:8081/index. bundle?platform=android&dev=true&minify=false:27371:15) 在 SQLitePluginTransaction.plugin.. 的新 Promise (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:27230:5)[as executeSql] (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:415656:23) 在 SQLitePluginTransaction.fn (http://localhost:8081/index.bundle?platform=android&dev= true&minify=false:415583:15) 在 SQLitePluginTransaction.start (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:416184:12) 在 http://localhost:8081/index.bundle?平台=android&dev=true&minify=false:415866:32开发=真&缩小=假:415866:32开发=真&缩小=假:415866:32
下面是将数据插入数据库的代码
return new Promise((resolve, reject) => {
db.transaction((trans) => {
trans.executeSql(
sql,
params,
(trans, results) => {
resolve(results);
},
(error) => {
reject(error);
}
);
});
});
}; ```