大佬帮忙翻译一下!谢谢

cc.Class({
    extends: cc.Component,

    properties: {
        spSelected: cc.Node,
        touched: {
            default: false,
            notify(){
                this.spSelected.active = this.touched;
            }
        },
    },
});

怎么翻译成TS 的语法
访问 这个 touched 属性 就能 直接调用到 这个 notify(){} 方法

notify是没办法用TS和ES6的语法定义的,这个方法只能是JS写

使用 set 函数代替即可

@property
private _touched : boolean= false;
public get touched() : boolean {
      return this._touched;
 }
@property
public set touched(v : boolean) {
     this._touched = v;
     this.spSelected.active = v;
}
1赞

这个是解决办法