[英]When keyboard is open in modal dismiss button does not work (Ionic 5)
[英]ionic 2 - keep keyboard open when clicking send button
當輸入/ textarea字段聚焦(?)時,離子鍵盤會打開。
但是當我點擊發送按鈕時,鍵盤就會消失。
即使我調用鍵盤插件的keyboard.show()方法,它也會先消失,然后重新出現。
有解決方案嗎?
<textarea id="chat-text-area></textarea>
sendMessage() {
if(window.cordova){
this.keyboard.show()
}
if(this.form.valid){
this.service.post(this.form.value).subscribe(res=>{
document.getElementById('chat-text-area').focus()
})
}
}
將此添加到您的發送按鈕:
(mousedown)="$event.preventDefault(); sendMessage($event)"
我希望有幫助:)
你能在hide事件中注入你的邏輯嗎?
window.addEventListener('native.keyboardhide', keyboardHideHandler);
function keyboardHideHandler(e){
if (something) // put your condition here
e.preventDefault();
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.