先上代码
import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;
export function Column(): any {
return function (target: any, key: string, desc: PropertyDescriptor) {
console.info(`[装饰器] target[${Object.keys(target)}] key[${key}]`);
desc.configurable = false
desc.enumerable = true
desc.get = function () { throw new Error('爆1') }
desc.set = function () { throw new Error('爆2') }
return desc
}
}
export class A {
@Column()
age?: number = 0
}
@ccclass('test')
export class test extends Component {
protected onLoad(): void {
let a = new A();
console.info(`a[${a}] a.age[${a.age}]`)
a.age = 25;
console.info(`a[${a}] a.age[${a.age}]`)
}
}
然后是执行画面
get 与 set 方法都没有被设置到
之前用 2.4.x 版的时候是能正常运作的
是还有哪需要设定吗?
请各位前辈指教一下,感谢


好像属性都是空的 寄存器才是有的 然后configurable为true enumerable为false