--- order: 3 title: zh-CN: 编辑模式 en-US: Editor mode --- ## zh-CN 评论编辑器组件提供了相同样式的封装以支持自定义评论编辑器。 ## en-US Comment can be used as editor, user can customize the editor component. ````jsx import { Comment, Icon, Tooltip, Avatar, Form, Button, List, Input } from 'antd'; import moment from 'moment'; const FormItem = Form.Item; const TextArea = Input.TextArea; function hasErrors(fieldsError) { return Object.keys(fieldsError).some(field => fieldsError[field]); } function CommentList({ comments }) { return ( 1 ? 'replies' : 'reply'}`} itemLayout="horizontal" dataSource={comments} renderItem={props => } /> ); } class Editor extends React.Component { handleSubmit = (e) => { e.preventDefault(); this.props.form.validateFields((err, values) => { if (!err) { this.props.onSubmit( values, () => this.props.form.resetFields() ); } }); } render() { const { getFieldDecorator, getFieldsError, getFieldError, isFieldTouched } = this.props.form; return (
{getFieldDecorator('message', { rules: [{ required: true, message: 'Please input your message!' }], })(