为了账号安全,请及时绑定邮箱和手机立即绑定

cvs.drawImage(this,0,0)的this

this该怎么理解?

imgObj.onload = function(){

     var cvs = $('#cvs_'+this.index)[0].getContext('2d');

     cvs.width = this.width;

     cvs.height = this.height;

     cvs.drawImage(this,0,0);

}


正在回答

1 回答

当imgObj加载完成后,this指向的imgObj的对象,this.width就是当前imgObj.width,然后通过当前imgObj的宽度值来赋值给canvas的宽度。

0 回复 有任何疑惑可以回复我~
#1

annynino 提问者

非常感谢!
2016-07-18 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
移动端的WEB相册
  • 参与学习       47987    人
  • 解答问题       217    个

本课程通过一个移动端相册案例,带您一步步了解移动端框架

进入课程

cvs.drawImage(this,0,0)的this

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信