账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    es6的class中函数之间调用报错?
    42
    0
    class Barrel{
        constructor(ele){
            this.ct=ele;
            this.baseHeight=100;
            this.maxWidth=ele.style.width;
            this.lastRowWidth=0;
            this.imgList=[];
            this.data=[];
        }
        createImg(arr){
            let num=0;
            for(let i in arr){
                this.data.push(arr[i]);
            }
            for(let i in this.data){
                let img=new Image();
                img.src=this.data[i];
                img.onload=function(){
                    let imgHeight=img.height;
                    let imgWidth=img.width;
                    let proportion=imgWidth/imgHeight;
                    let imgInfo={
                        self:img,
                        width:this.baseHeight*proportion,
                        height:this.baseHeight
                    }
                
                    this.render(imgInfo,num);
                    num++;
                }
            }
        }
        render(imgInfo,num){...}

    报错信息:Uncaught TypeError: this.render is not a function
    请问应该怎么改?

    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 眠于流年 普通会员 1楼
      502 Bad Gateway

      502 Bad Gateway


      nginx
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部