让input一直保持聚焦和聚焦全选

让input一直保持聚焦只需要在input失去焦点事件中再次添加焦点就可以保证永永远不失去焦点了

// 原生js
<input onblur="this.focus()" />
// vue中
<input @blur="$event.target.focus()" />

让input聚焦全选

// 原生js
<input onfocus="this.select()" />
// vue中
<input @focus="$event.target.select()" />
posted @ 2021-12-06 16:43  lwlcode  阅读(2814)  评论(0编辑  收藏  举报