window.sqlitePlugin未定义-但已安装sqlite
我已尝试通过window.sqlitePlugin未定义-但已安装sqlite,sqlite,cordova,cordova-plugins,Sqlite,Cordova,Cordova Plugins,我已尝试通过cordova sqlite storage安装此插件。我使用框架 看起来插件已经安装,因为当我再次键入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 insta
cordova sqlite storage
安装此插件。我使用框架
看起来插件已经安装,因为当我再次键入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未定义
将其添加到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 -->
将此添加到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 -->