活动页弹框有个输入框,之前没有遇到过这个问题,这次不知道怎么出现了。

<p class="search" ref='button'>
   <input type="number" ref="input1" v-model="val" placeholder="请输入用户id" v-on:input="searchFun" />
</p>
 
当弹框出现时执行:
this.$refs.button.addEventListener('click', (e) => {
  this.$nextTick(() => {
    this.$refs.input1 && this.$refs.input1.focus()
  })
});
 
参考:https://blog.csdn.net/xiao_yu_liu/article/details/109519813
posted on 2021-09-26 16:05  wxx17513  阅读(200)  评论(0编辑  收藏  举报