是否可以在静态方法中使用ES6创建一个新的self / this实例?例如;
class myClass { static model() { return new this; } }
这种情况是否有公认的模式?
非常感谢。
是的,这正是你做的。
如果您不希望子类使用子类构造函数,请明确地按名称引用您的类,类似于accessing other static methods。