Skip to content

Commit

Permalink
feat: input controlled
Browse files Browse the repository at this point in the history
  • Loading branch information
jc9702507 committed Mar 9, 2023
1 parent 126934e commit 7e8c9fc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 0 additions & 1 deletion demo/pages/Input/index.axml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
placeholder="请输入内容"
allowClear
onChange="handleChange"
onClear="clear"
/>

<button onTap="clear" inline size="small">clear</button>
Expand Down
1 change: 1 addition & 0 deletions src/Input/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ toc: 'content'
| 属性 | 说明 | 类型 | 默认值 |
| -----|-----|-----|-----|
| className | 类名| string | - |
| controlled | 有键盘输入问题,可使用 controlled="{{false}}" | boolean | - |
| defaultValue | 初始值 | string | - |
| disabled | 是否禁用 | boolean | false |
| maxLength | 最大长度 | number | 140 |
Expand Down
3 changes: 3 additions & 0 deletions src/mixins/value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ export default ({
return equal(this.getValue(prevData), this.getValue());
},
isControlled() {
if ('controlled' in this.props) {
return this.props.controlled;
}
return valueKey in this.props;
},
updateControlled() {
Expand Down

0 comments on commit 7e8c9fc

Please sign in to comment.