Vue.JS value tied on input having the focus

前端 未结 4 1609
孤街浪徒
孤街浪徒 2021-01-31 14:20

Is there a way to change a value in the model when an input gets/loses focus?

The use case here is a search input that shows results as you type, these should only show

4条回答
  •  面向向阳花
    2021-01-31 15:08

    You might also want to activate the search when the user mouses over the input - @mouseover=...

    Another approach to this kind of functionality is that the filter input is always active, even when the mouse is in the result list. Typing any letters modifies the filter input without changing focus. Many implementations actually show the filter input box only after a letter or number is typed.

    Look into @event.capture.

提交回复
热议问题