我这块有四个文件,分别是 a ,ap ,b ,bp ,
我最开始写的是 b 通过继承调用 a 里面的 init 方法,init 方法里面会调用执行 ap 里面的 drawAll 方法,但是这个时候再 bp 里面重写 drawImgBoxArea 方法的话并不会生效,
public async init(): Promise<void> {
await super.init()
await this.selfPresenter.drawAll()
this.addListener()
}
之后我在 bp 里面写了个 drawAll 方法,里面通过 super 继承 b 的 drawAll 方法,再在 b 里调用 bp 的 drawAll ,这个时候重写 drawImgBoxArea 就会生效,
不过我在父类的 drawAll 里面最开始的时候会获取 imgList 然后赋值给 VM_ImgLis 变量,然而这么写的话我重写的 drawImgBoxArea 里面 console.log(this.VM_ImgList)的结果是空,获取不到父类的变量,
public async drawAll(): Promise<void> {
await super.drawAll()
}
public drawImgBoxArea(){
console.log(this.VM_ImgList)
}
我想问下这块是为什么啊。