将Antd TextArea值设置为Tag组件

时间:2019-04-30 09:50:09

标签: javascript reactjs antd

我有reactjs Antd表单,我想在TextArea中渲染Tag组件,类似于Select组件! enter image description here

我尝试通过

设置值
values.description = <Tag color="magenta">magenta</Tag>
this.props.form.setFieldsValue(values);

函数,但显示[object Object] [enter image description here] 2

<Form.Item label={<span>Description</span>}>
    {getFieldDecorator('description', {
                                  initialValue:''
                                   })(
   <TextArea maxLength={500} autosize={{ minRows: 4, maxRows: 4 }} 
                     placeholder={'Description'} />
                                    )}
 </Form.Item>

我希望获得与选择组件Antd Select Component相同的结果 有关如何操作的任何想法?

1 个答案:

答案 0 :(得分:0)

这与TextArea无关。您正在寻找的是content editable div,这很容易做到:

<div contenteditable="true">
  <Tag color="magenta">magenta</Tag>
</div>