我试着用cordova-sqlite-storage安装了这个插件https://github.com/xpbrew/cordova-sqlite-storage。我使用framework7。
看起来插件已经安装了,因为当我再次输入install命令时,我看到
C:\Users\User\Desktop\pj>cordova plugin add cordova-sqlite-storage
Plugin "cordova-sqlite-storage" already installed on android.
Plugin "cordova-sqlite-storage" already installed on browser.
Adding cordova-sqlite-storage to package.json这是我使用sqlite: routes.js的代码
routes = [
{
path: '/',
url: './index.html',
},
{
path: '/drive/',
url: './pages/drive.html',
on: {
pageInit: function (e, page) {
//db start
window.sqlitePlugin.echoTest(function() {
console.log('ECHO test OK');
alert('ECHO test OK');
});
window.sqlitePlugin.selfTest(function() {
console.log('SELF test OK');
alert('SELF test OK');
});
[...]在控制台中我看到了TypeError: window.sqlitePlugin is undefined
发布于 2020-04-08 19:41:09
将这段代码添加到index.html中,但要放在任何脚本之前:
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="plugins/cordova-sqlite-storage/www/SQLitePlugin.js"></script>
<!-- your other scripts here -->https://stackoverflow.com/questions/56188777
复制相似问题