Ответ 1
Используйте this
import blah from './blaha';
export default class myclass{
constructor(con) {
this.config = con;
}
async meth1(paramA) {
//do_stuff...
}
meth2(paramB) {
this.meth1()
}
}
Я пытаюсь вызвать метод класса в моем классе, создавая соседний метод, как показано в примере ниже.
import blah from './blaha';
export default class myclass{
constructor(con) {
this.config = con;
}
async meth1(paramA) {
//do_stuff...
}
meth2(paramB) {
//attempt to call meth1()
}
}
Я хотел бы вызвать метод из другого метода, используя стили класса es6.
Используйте this
import blah from './blaha';
export default class myclass{
constructor(con) {
this.config = con;
}
async meth1(paramA) {
//do_stuff...
}
meth2(paramB) {
this.meth1()
}
}