我在我的项目中使用cordova 5.1.1
。我有cordova_plugins.js
文件插件的声明:
{
"file": "plugins/cordova-plugin-file/www/FileSystem.js",
"id": "cordova-plugin-file.FileSystem",
"clobbers": [
"window.FileSystem"
]
},
但是当我尝试使用这样的插件时:
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0,
onFileSystemSuccess, fail);
我明白了:
Uncaught ReferenceError: LocalFileSystem is not defined
答案 0 :(得分:0)
没有响应侦听器,因此没有加载文件插件,这就是你得到的原因
Uncaught ReferenceError: LocalFileSystem is not defined
添加此内容并在其中包含您的请求:
document.addEventListener("deviceready", function() {
//use request file here
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0,
onFileSystemSuccess, fail);
}, false);