import {Component} from '@angular/core'; import {MatDialogRef} from '@angular/material'; @Component({ selector: 'app-show-alert', template: `

{{title}}

{{content}} `, styleUrls: ['./show.component.scss'] }) export class ShowAlertComponent { title: string; content: string; close: string = '确定'; } @Component({ selector: 'app-show-confirm', template: `

{{title}}

{{content}} `, styleUrls: ['./show.component.scss'] }) export class ShowConfirmComponent { title: string; content: string; cancelLabel: string = '取消'; acceptLabel: string = '确定'; constructor(private dialog: MatDialogRef) { } cancel() { this.dialog.close(false); } accept() { this.dialog.close(true); } } @Component({ selector: 'app-show-prompt', template: `

{{title}}

{{content}} `, styleUrls: ['./show.component.scss'] }) export class ShowPromptComponent { value: string; title: string; content: string; cancelLabel: string = '取消'; acceptLabel: string = '确定'; constructor(private dialog: MatDialogRef) { } accept() { this.dialog.close(this.value); } cancel() { this.dialog.close(null); } }