@Component({
selector: 'app-component',
})
class AppComponent {
@HostListener('window:keydown', ['$event'])
doSomething($event) {
// alt + s
if($event.altKey && $event.altKey === 83) {
// perform some action
// saveForm();
// also added this but still triggering in IE11
$event.preventDefault();
}
}
}
我尝试添加$ event.preventDefault(),$ event.stopPropagation(),$ event.cancelBubble = true;还有其他几个。
我的问题是它正在执行saveForm();
,但也会触发IE11中的安全按钮。如何在IE中打开安全按钮?