tc39 babel 装饰器,有没有办法使用方法装饰器访问类?

问题描述

使用方法装饰器时如何访问类,在其上定义一些属性

class Test {
    @Meta
    hello() {}

    @Meta
    sayHi() {}
}

function Meta(descriptor) {
    // I want to access the Test class,assign custom config on it,// but the descriptor.finisher param only work for class decorator,// how to assign properties to the class
    // for example set Test.Meta = ['hello','sayHi'] when method hello,sayHi has this decorator
    // not on decorator legacy mode,// the descriptor is like {kind: 'method',placement: 'prototype',...}
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)