43 lines
1009 B
TypeScript
43 lines
1009 B
TypeScript
import {Component, input, Input, output} from '@angular/core';
|
|
import {NzModalComponent} from "ng-zorro-antd/modal";
|
|
import {NzButtonComponent} from "ng-zorro-antd/button";
|
|
|
|
@Component({
|
|
selector: 'app-modal-button',
|
|
imports: [
|
|
NzModalComponent,
|
|
NzButtonComponent,
|
|
],
|
|
templateUrl: './modal-button.html',
|
|
styleUrl: './modal-button.css',
|
|
})
|
|
|
|
export class ModalButton {
|
|
size = input<string>();
|
|
name = input.required<string>()
|
|
type = input<"primary" | "default" | "dashed" | "link" | "text">()
|
|
|
|
ok = output<void>();
|
|
cancel = output<void>();
|
|
|
|
isVisible = false;
|
|
isOkLoading = false;
|
|
|
|
showModal(): void {
|
|
this.isVisible = true;
|
|
}
|
|
|
|
handleOk(): void {
|
|
this.isOkLoading = true;
|
|
setTimeout(() => {
|
|
this.ok.emit();
|
|
this.isVisible = false;
|
|
this.isOkLoading = false;
|
|
}, 1000);
|
|
}
|
|
|
|
handleCancel(): void {
|
|
this.cancel.emit();
|
|
this.isVisible = false;
|
|
}
|
|
} |