storedataAndroid本地文件存储插件使用指南
在本地存储数据时,cordova项目需要一些插件支持。首先,在项目目录中运行以下命令以添加插件:
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-file.git
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer.git
然后,将文件storedata.js复制到项目中,并在index.html中包含相应的脚本语句。虽然项目中不需要common.js和index.html,但它们提供了测试功能和显示用法。要进行测试,只需将所有文件添加到新的cordova项目中即可。对于实际使用,只需要localfile.js。读取本地文件时,需提供两个参数:文件名和回调函数onC。
下载地址
用户评论