|
楼主 |
发表于 2019-12-6 15:52:24
|
显示全部楼层
本帖最后由 常宝住 于 2019-12-6 15:58 编辑
手机端打包的时候勾选了这个插件。JS里面怎么引入这个插件呢?报cordova is not defined。
require("cordova!cordova-plugin-file-transfer");
var mokey = {};
//点击下载按钮
Model.prototype.a5Click = function(event){
alert(1);
var me = this;
mokey.download(
"http://pic.qiantucdn.com/58pic/11/84/23/13A58PIC6ZC.jpg!/fw/780/watermark/url/L3dhdGVybWFyay12MS4zLnBuZw==/align/center",
cordova.file.externalCacheDirectory + "test.jpg",
function (entry) {
console.log("Successful download...");
console.log("download complete: " + entry.toURL());
window.open(entry.toURL());
},
function (error) {
console.log("download error source " + error.source);
console.log("download error target " + error.target);
console.log("upload error code" + error.code);
},
null, // or, pass false
{
//headers: {
// "Authorization": "Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=="
//}
}
);
}; |
|