Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1800|回复: 0
打印 上一主题 下一主题

[html_html5_css]-----blob

[复制链接]

388

主题

602

帖子

2218

积分

金牌会员

Rank: 6Rank: 6

积分
2218
跳转到指定楼层
楼主
发表于 2015-10-30 19:38:37 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 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);
  }

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|firemail ( 粤ICP备15085507号-1 )

GMT+8, 2024-9-28 02:12 , Processed in 0.055206 second(s), 20 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表