feat: textarea 支持设置 readOnly (#1643)

This commit is contained in:
吴多益 2021-03-14 16:08:14 +08:00 committed by GitHub
parent 203401cea6
commit c1e89ecf05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 5 deletions

View File

@ -29,7 +29,8 @@ order: 57
当做选择器表单项使用时,除了支持 [普通表单项属性表](./formitem#%E5%B1%9E%E6%80%A7%E8%A1%A8) 中的配置以外,还支持下面一些配置
| 属性名 | 类型 | 默认值 | 说明 |
| ------------ | --------- | ------ | ---------------------- |
| ------------ | --------- | ------ | -------------------- |
| minRows | `number` | | 最小行数 |
| maxRows | `number` | | 最大行数 |
| trimContents | `boolean` | | 是否去除首尾空白文本。 |
| trimContents | `boolean` | | 是否去除首尾空白文本 |
| readOnly | `boolean` | | 是否只读 |

View File

@ -23,6 +23,11 @@ export interface TextareaControlSchema extends FormBaseControl {
*
*/
minRows?: number;
/**
*
*/
readOnly?: boolean;
}
export interface TextAreaProps extends FormControlProps {
@ -92,8 +97,10 @@ export default class TextAreaControl extends React.Component<
disabled,
minRows,
maxRows,
readOnly,
name
} = this.props;
return (
<Textarea
autoComplete="off"
@ -110,6 +117,9 @@ export default class TextAreaControl extends React.Component<
: JSON.stringify(value)
}
placeholder={placeholder}
autocorrect="off"
spellcheck="false"
readOnly={readOnly}
minRows={minRows}
maxRows={maxRows}
onChange={this.handleChange}