prompt-modal.component.ts 961 B

123456789101112131415161718192021222324252627282930313233
  1. import { Component, OnInit, Input, Output, EventEmitter } from "@angular/core";
  2. import host from "../../../assets/js/http";
  3. @Component({
  4. selector: "app-prompt-modal",
  5. templateUrl: "./prompt-modal.component.html",
  6. styleUrls: ["./prompt-modal.component.less"],
  7. })
  8. export class PromptModalComponent implements OnInit {
  9. host = host.host;
  10. @Input() content: string;
  11. @Input() success: boolean;
  12. @Input() show: boolean;
  13. @Input() info: string;
  14. @Input() back: string = "";
  15. @Input() isReLoad: Boolean = false;
  16. @Input() loading: Boolean = false;
  17. @Output() closeModel = new EventEmitter<any>(); //1.组件暴露一个 EventEmitter 属性,当事件发生时,子组件利用该属性 emits(向上弹射)事件
  18. constructor() {}
  19. ngOnInit() {
  20. console.log(this.show);
  21. }
  22. hideModal() {
  23. this.show = false;
  24. this.closeModel.emit(this.back); //emits(向上弹射)事件
  25. if (this.isReLoad) {
  26. location.reload(true);
  27. }
  28. }
  29. }