我有一个类名对话框。在这个类中,我有一个方法 hide() 来隐藏对话框本身及其模式框。但我无法从“onclick”功能访问隐藏功能。我怎样才能访问它?
class Dialog{
constructor(id){
this._dialogBox = $('.dialog#'+this.id);
this._closeButton = this._dialogBox.find('span.closedialog');
this._closeButton.on('click', function(){
//how to access hide() function from here?
});
}
hide(){
this._dialogBack.hide();
this.dialogBox.hide();
}
}