根据此链接https://ionicframework.com/docs/api/input#events ionic 支架按键 在浏览器中运行良好但在移动设备中未触发的事件
html
<ion-item>
<ion-label>Default Label</ion-label>
<ion-input (keypress)="test($event)"></ion-input>
</ion-item>
ts
test(event){
console.log(event);
e.preventDefault();
}
the above code works fine in ionic serve not in mobile device
据此https://developer.mozilla.org/en-US/docs/Web/API/Document/keypress_event按键被贬低我不明白
Events i tried: keypress, keydown, keyup, ionblur, ionChange, input,..etc Either it is not working or it or preventdefault is not working
最佳答案
根据您自己的第一个链接,我猜您正在寻找事件 ionInput Emitted when a keyboard input ocurred.
:
<ion-item>
<ion-label>Default Label</ion-label>
<ion-input (ionInput)="test($event)"></ion-input>
</ion-item>
关于javascript - ionic 4中的(按键)事件未触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56931693/