[英]Angular iOS text field focus
當我打開帶有輸入的 div 時,我需要打開移動鍵盤。 我試圖設置輸入的焦點
this.changeCityInput.nativeElement.focus();
當我單擊父 div 時觸發。 單擊父 div 子擴展並顯示輸入字段后
但它在 ios 上不起作用,對於桌面和 android 它工作正常。
還
document.body.ontouchend = () => {
this.changeCityInput.nativeElement.focus();
};
setTimeout(() => {
this.renderer.selectRootElement(this.changeCityInput.nativeElement).focus();
this.changeCityInput.nativeElement.focus();
}, 500);
不工作。 將重點放在輸入上的正確方法是什么?
UPD:在 MacOS 上正常工作
焦點()不適用於禁用按鈕我模擬禁用操作
默認情況下,當我使用輸入打開 div 時,我將注意力集中在它上面,完成后我使用 blur() 取消焦點
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.