如果浏览器关闭,我需要执行一个 Api,例如中断,从用户关闭浏览器,PC 崩溃,ext ext。此功能在我的组件中,我不会在任何地方调用此功能,我认为它应该会自动激活。 @HostListener('window:beforeunload', ['$event']) beforeunloadHandler(event) { this.postService.unsetPost(this.postId).subscribe(); }但不工作。
添加回答
举报
0/150
提交
取消
