jd-opensource / jd-opensource/taro-ui

AtInput 组件maxlength、属性无效

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

Description

### Taro UI 版本信息

v2.3.4

### 问题描述

maxlength、属性无效

### 复现步骤

按照官方文档引入
版本号:
"taro-ui": "3.0.0-alpha.3"

### 复现代码

const Code= () => {
const [mobile, setMobile] = useState('')
return (

setMobile(value)}
>
验证码

)
}

### 报错信息

### 系统信息

Taro CLI 3.0.2 environment info:
System:
OS: Windows 10
Binaries:
Node: 12.13.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.4 - C:\Program Files\nodejs\yarn.CMD
npm: 6.12.1 - C:\Program Files\nodejs\npm.CMD

### 补充信息

版本信息为"taro-ui": "3.0.0-alpha.3"
通过debug调试发现问题,在input.js里的getInputProps方法,定义的actualProps的key 为 maxLength,但是在取值的时候又定义为 maxlength,但是这个属性无法传入,所以不生效。

建议:修改actualProps里的maxLength 为 maxlength

Contributor guide

Open the contributing guide

Research direction

Open input.js and inspect the getInputProps method, especially the actualProps key and where maxlength is read. Correct the property-name mismatch and verify that AtInput enforces a six-character maximum with the reproduction shown in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.