firemail
标题:
[html_html5_css]-----blob
[打印本页]
作者:
hechengjin
时间:
2015-10-30 19:38
标题:
[html_html5_css]-----blob
本帖最后由 hechengjin 于 2015-10-30 19:43 编辑
function* fetpic(uriOptions) {
let XHR = require('app://app/mail/net/XHR.js');
let image = yield XHR.fetch(uriOptions);
let myavatar = image.request.response;
expect(myavatar.toString()).to.eql('[object Blob]')
return myavatar;
}
let uriOptions = {
uri:'http://news.cnr.cn/native/pic/20151023/W020151023244447426179.jpg',
}
let myavatar = yield* fetpic(uriOptions);
let blobUri = URL.createObjectURL(myavatar );
showPic(blobUri );
function showPic(BlobUri) {
let img = document.createElement("img");
img.onload = function(e) {
//console.log('onload ');
};
img.src = BlobUri;
console.log('img.src : ' + img.src);
let eleAppend = document.getElementById("forAppend");
eleAppend.appendChild(img);
}
欢迎光临 firemail (http://firemail.wang:8088/)
Powered by Discuz! X3