1

我开发了一个垫子对话框,只有当我单击关闭按钮时才会关闭,这意味着它被设置为禁用。当我的对话框打开时,我想在后台输入。如何启用此功能?

代码:

// Important snippet from dialog component
constructor(
    public dialogRef: MatDialogRef<KagListComponent>) {
    dialogRef.disableClose = true;
  }
// Important snippet from app component
/**
   * Open the dialog
   */
  openDialog(): void {
    const dialogRef = this.dialog.open(DialogComponent, {
      width: '600px',
      backdropClass: 'transparent'
    });
    dialogRef.afterClosed().subscribe(result => {
      console.log(`Dialog will be closed!`, result);
    });
  }

我试图hasBackDrop= true在函数中激活背景。不幸的是,它没有用。你知道我该如何解决这个问题吗?

4

0 回答 0