Skip to content

Commit

Permalink
fix: Input组件showLength为true时初始长度未计算的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
JeromeLin committed Aug 24, 2017
1 parent c0c5c7f commit 64e3bc3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion components/Input/Input.jsx
Expand Up @@ -7,7 +7,7 @@ class Input extends PureComponent {
constructor(props) {
super(props);
this.state = {
length: 0,
length: (props.value || props.defaultValue || '').length,
};
this.onInputChange = this.onInputChange.bind(this);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/pages/InputPage.jsx
Expand Up @@ -46,7 +46,7 @@ class Page extends Component {
<Panel.Title>显示输入字数</Panel.Title>
</Panel.Header>
<Panel.Body>
<Cell><Input autosize showLength type="textarea" rows="4" maxLength="200" placeholder="摘要" /></Cell>
<Cell><Input autosize showLength type="textarea" rows="4" maxLength="200" placeholder="摘要" value="111" /></Cell>
</Panel.Body>
</Panel>

Expand Down

0 comments on commit 64e3bc3

Please sign in to comment.