没有对象的访问方法(如静态)

我想在不创建对象或调用document.ready事件的构造函数的情况下调用类方法。 我尝试了不同的选择,但没有任何效果。

var objReportsInterface; class ReportsInterface extends ReportBase { constructor() { super(); objReportsInterface = this; } subCategories() {} } $(document).ready(function() { $("dropdown").on('change', function() objReportsInterface.subCategories(); }) }) 
   

我找到了一个静态方法,但获得了与我的代码相关的任何示例。 在我的情况下,我可以使用静态方法吗?

要创建静态方法(也就是说,附加到构造函数本身而不是实例的方法),请使用static

 class ReportsInterface { // ... static subCategories() { // ... } } 

然后

 $("dropdown").on('change', function() ReportsInterface.subCategories(); });