uniapp input 输入框实现自动选中

389 阅读1分钟
<input id="select" v-model="value" :focus="focus" @focus="render._select">
<script module="render" lang="renderjs">
  export default {
    methods: {
      _select() {
        document.querySelector('#select input').select()
      }
    }
   }
</script>

亲测安卓苹果H5都是可以用的,但是注意了,如果用uview UI框架里的<u--input> </u--input>不可以,暂时没有找到原因,有知道为什么的小伙伴可以评论区留言哟,交流一下,共同进步!