html

(1、input  type='search'   2、将input套在一个带action的form中 )

  <form action="">
    <ion-input type="search" placeholder="请输入搜索关键字" (keypress)='test($event)'></ion-input>
  </form>

typescript

(监听input的keypress事件)

  test(event) {
    if (event && event.keyCode == 13) {
      alert('yes');
    }
  }

 补充:关闭input自动完成

 autocomplete='off'
        <form action="">
          <input autocomplete='off' class="usIndexsch" type="search" name='key' placeholder="目的地/关键词" [(ngModel)]='key' (keypress)='keySelect($event)'>
        </form>

 

相关文章:

  • 2021-12-07
  • 2021-06-13
  • 2022-12-23
  • 2021-07-11
  • 2021-08-23
  • 2021-11-16
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
  • 2022-01-21
相关资源
相似解决方案