如题
createDownloadTasks(head, {
method: 'get',
filename: "UHead" + cids + '.jpg'
});
var dtasks = null;
function createDownloadTasks(url, options) {
if(dtasks) {
alert(999999)
return;
}
alert(url)
dtasks = plus.downloader.createDownload(url, options);
dtasks.start();
dtasks.addEventListener("statechanged", function(task, status) {
if(!dtasks) {
alert("dtasksno")
return;
}
switch(task.state) {
case 1: // 开始
break;
case 4: // 打包后这下面的代码 需要好久才执行
alert(task.filename+"444")
var path=plus.io.convertLocalFileSystemURL(task.filename);
alert(path) //path 有值 但是下一步不执行 什么原因啊
plus.io.resolveLocalFileSystemURL(path, function(entry) {
alert(task.filename+"jjjj") // 打包后这句话不执行
}, function(e) {
console.log('读取文件错误:' + e.message);
});
dtasks = null;
break;
}
});
}
上面代码 在线运行 能正常使用。但是打包后就不正常运行了 什么情况
0 个回复