// 普通方法,target 对应的是类的 prototype// 静态方法,target 对应的是类的构造函数function getNameDecorator(target: any, key: string, descriptor: PropertyDescriptor) {// console.log(target, key);// descriptor.writable = true;descriptor.writable = falsedescriptor.value = function() {return 'decorator';};}class Test {name: string;constructor(name: string) {this.name = name;}@getNameDecoratorgetName() {return this.name;}}const test = new Test('dell');console.log(test.getName());
