gpt4 book ai didi

javascript - Angular 2 如何在按钮返回时模糊输入?

转载 作者:行者123 更新时间:2023-12-01 15:51:19 25 4
gpt4 key购买 nike

如何模糊input按 native 键盘返回 button在移动 ?

例如 :

<input type="text" #search>

this.search.blur() //-- unfocus and hide keyboard

最佳答案

html文件

<input type="text"  #search (keyup.enter)="doSomething()">

.ts 文件
import { Component, ViewChild, ElementRef} from '@angular/core';

@ViewChild('search') search: ElementRef;

doSomething(): void {
this.search.nativeElement.blur()
}

工作 stackblitz

关于javascript - Angular 2 如何在按钮返回时模糊输入?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53518669/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com