【发布时间】:2020-03-18 09:34:21
【问题描述】:
我有以下html代码,我需要识别事件是鼠标点击事件还是键盘回车键事件。
HTML代码
<button mat-raised-button class="btn-enter-troubleshooting-attempts"
(click)="triggerLog($event)"> Click/Enter </button>
键入脚本
triggerLog(e): void {
console.log('Log Attempt', e);
//do some function based on the event
}
【问题讨论】:
标签: javascript angular