问题描述
我在Sample.html
中有一个定义的地方
<input (keydown.Enter)="onKeyEnter($event)" ...
在我的Sample.ts
中定义了
onKeyEnter(event: KeyboardEvent): void {
....
event.preventDefault();
event.stopPropagation();
}
我遇到strictTemplates
失败
error TS2345: Argument of type 'Event' is not assignable to parameter of type 'KeyboardEvent'.
这有点奇怪,因为在input
中只能得到一个KeyboardEvent
。有办法摆脱这个错误吗?我认为这是误报。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)