import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; @Component({ selector: 'app-incident-recording', templateUrl: './incident-recording.component.html', styleUrls: ['./incident-recording.component.less'] }) export class IncidentRecordingComponent implements OnInit { @Output() closeModelHs = new EventEmitter();//1.组件暴露一个 EventEmitter 属性,当事件发生时,子组件利用该属性 emits(向上弹射)事件 @Input() path: any; constructor() { } audioPath = ""; //录音文件地址 ngOnInit() { this.audioPath = location.origin + this.path; } // 关闭弹窗 hideModal() { this.closeModelHs.emit(JSON.stringify({ show: false }));//emits(向上弹射)事件 } }