jd-opensource / jd-opensource/taro-ui

AtInput 聚焦时光标没有定位到文本的最后

Open
#1,380 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
4.7k
Forks
740
PR merge metrics
No merged PRs in 30d

Description

**问题描述**
Input 控件,有这样一个问题,失焦后点击输入框再聚焦,光标是定位文本的开头而不是最后

**复现步骤**
1、输入文字
2、收起键盘使 Input 失焦
3、点击 Input 输入框聚焦

官方示例源码即可复现:
```js
import Taro from '@tarojs/taro'
import { AtInput } from 'taro-ui'
export default class Index extends Taro.Component {
constructor () {
super(...arguments)
this.state = {
value: ''
}
}
handleChange (value) {
this.setState({
value
})
// 在小程序中,如果想改变 value 的值,需要 `return value` 从而改变输入框的当前值
return value
}
render () {
return (

)
}
}
```

**期望行为**
聚焦时光标定位到文本的最后

**报错信息**

**系统信息**
Taro CLI 3.3.0 environment info:
System:
OS: macOS 11.4
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.16.1 - /usr/local/bin/node
npm: 6.14.12 - /usr/local/bin/npm
npmPackages:
@tarojs/cli: 3.2.8 => 3.2.8
@tarojs/components: 3.2.8 => 3.2.8
@tarojs/mini-runner: 3.2.8 => 3.2.8
@tarojs/react: 3.2.8 => 3.2.8
@tarojs/runtime: 3.2.8 => 3.2.8
@tarojs/taro: 3.2.8 => 3.2.8
@tarojs/webpack-runner: 3.2.8 => 3.2.8
babel-preset-taro: 3.2.8 => 3.2.8
eslint-config-taro: 3.2.8 => 3.2.8
react: ^17.0.0 => 17.0.2
taro-ui: ^3.0.0-alpha.10 => 3.0.0-alpha.10

**补充信息**
使用 @tarojs/components 的 Input 组件无此问题

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.