0

如果这样写<Input type="textarea" placeholder="不能超过50字" maxLength={50} autosize />,会报错Received true for a non-boolean attribute autosize;

如果这样写<Input type="textarea" placeholder="不能超过50字" maxLength={50} autosize={true} />,也会报错Received true for a non-boolean attribute autosize;

如果这样写<Input type="textarea" placeholder="不能超过50字" maxLength={50} autosize='true' />,会报错Failed prop type: Invalid prop autosize supplied to Input.

autosize属性应该是怎么写呢,官网api写的是autosize

3个回答

0

已采纳

antd案例是这么写的,不是设置type="textarea",而是用<TextArea autosize/>

import { Input } from 'antd';
const { TextArea } = Input;

ReactDOM.render(
  <div>
    <TextArea placeholder="Autosize height based on content lines" autosize />
    <div style={{ margin: '24px 0' }} />
    <TextArea placeholder="Autosize height with minimum and maximum number of lines" autosize={{ minRows: 2, maxRows: 6 }} />
  </div>
, mountNode);
0
0

直接,< Input.TextArea />

撰写答案

Planets