es6从同一个类中调用类方法

And*_*ata 25 javascript oop node.js ecmascript-6

我试图在我的类中调用一个类方法形成一个邻近的方法,如下面的例子所示.

import blah from './blaha';

export default class myclass{
  constructor(con) {
    this.config = con;
  }

  async meth1(paramA) {
    //do_stuff...
  }

    meth2(paramB) {
     //attempt to call meth1()
  }

}
Run Code Online (Sandbox Code Playgroud)

我想使用es6类样式从一个不同的方法中调用一个方法.

dco*_*enb 27

使用 this

import blah from './blaha';

export default class myclass{
  constructor(con) {
    this.config = con;
  }

  async meth1(paramA) {
    //do_stuff...
  }

  meth2(paramB) {
     this.meth1()
  }
}
Run Code Online (Sandbox Code Playgroud)