input框全选之setSelectionRange

<InputItem
      ref = {ref => this[inputRef] = ref}
      onFocus={(e)=>{
            if(this[inputRef] && this[inputRef].inputRef && this[inputRef].inputRef.inputRef) {
                 const ref = this[inputRef].inputRef.inputRef;
                 ref.select && ref.select();
                 setTimeout(()=> {
                       ref.setSelectionRange && ref.setSelectionRange(0, 99999);
                 }, 100);
            }
     }}
/>
posted @ 2021-05-26 09:35  菜鸟乐谷  阅读(512)  评论(0编辑  收藏  举报