无法访问成员数据 Three.js TypeScript
Can't access member data Three.js TypeScript
我正在使用来自 DefinitelyTyped 和 TypeScript 的 three.d.ts。我有以下代码
class WoodStyle extends THREE.MeshBasicMaterial{
putTexture(image: any){
super.map=image;
}
constructor(){
LoadImage().then(putTexture);
super();
}
}
我在其中加载图像,然后用新图像更新 material。但是当我尝试编译代码时,它显示错误:2340 Only public and protected methods of the base class are accessible via the 'super' keyword
。我做错了什么?
访问继承的 属性 时,使用 this
:
class WoodStyle extends THREE.MeshBasicMaterial{
putTexture(image: any){
this.map=image;
}
constructor(){
LoadImage().then(putTexture);
super();
}
}
我正在使用来自 DefinitelyTyped 和 TypeScript 的 three.d.ts。我有以下代码
class WoodStyle extends THREE.MeshBasicMaterial{
putTexture(image: any){
super.map=image;
}
constructor(){
LoadImage().then(putTexture);
super();
}
}
我在其中加载图像,然后用新图像更新 material。但是当我尝试编译代码时,它显示错误:2340 Only public and protected methods of the base class are accessible via the 'super' keyword
。我做错了什么?
访问继承的 属性 时,使用 this
:
class WoodStyle extends THREE.MeshBasicMaterial{
putTexture(image: any){
this.map=image;
}
constructor(){
LoadImage().then(putTexture);
super();
}
}