Typescript @property装饰器中visible如何得到this

@property
public instantRotation : boolean = false;

@property({
visible: this.instantRotation
})
angularSpeed : number = 0;

报错:TypeError: Cannot read property ‘instantRotation’ of undefined

直接改成这样写就行了:
visible:function(){return this.instantRotation},
装饰器会自动绑定this

1赞