我在我的项目中使用 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
最佳答案
没有响应监听器,所以文件插件没有加载,这就是你得到的原因
Uncaught ReferenceError: LocalFileSystem is not defined
添加这个并在其中包含您的请求:
document.addEventListener("deviceready", function() {
//use request file here
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0,
onFileSystemSuccess, fail);
}, false);
关于javascript - Cordova 文件插件不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31583838/