获得徽章 12
- import 'reflect-metadata';
function showData(target: typeof User){
for(let key in target.prototype){
console.log(key)
const data = Reflect.getMetadata('data', target.prototype, key);
console.log(data);
}
}
@showData
class User {
name = 'John';
@Reflect.metadata('data', 'name')
getName() {}
@Reflect.metadata('data', 'age')
getAge() {}
}
这段代码使用 ts-node 执行 为什么不打印 把 tsconfig.json 配置中 "target" 改成 es5 才能打印展开评论点赞 - 兄弟们,刚才那一刻有点心凉,房租,水电,燃气这些都是我出现,然后1,2,3月份每个月给女朋友转3千,女朋友还老说没钱……,然后这个月给她买衣服,就问了问为啥你没钱,2月份在老家没什么开销呀……,最后终止于……她说谁叫你是男的……心里有点凉,掘金大佬们一个月给女朋友多钱?评论点赞
- 等人赞过54
,测试说个 bug 别的前端懂业务,说两句就行,我需要从头到尾演示一下![[不失礼貌的微笑]](http://lf-web-assets.juejin.cn/obj/juejin-web/xitu_juejin_web/img/jj_emoji_16.9d17f6d.png)
![[骷髅]](http://lf-web-assets.juejin.cn/obj/juejin-web/xitu_juejin_web/img/jj_emoji_35.8d57f28.png)