import React, { PureComponent} from 'react';
import { Typography } from 'antd';
import { HighlightOutlined } from '@ant-design/icons';
const { Paragraph } = Typography;
export default class Right extends PureComponent {
constructor(props){
super(props);
this.state={
customIconStr:"编辑前的初始值",
}
};
setCustomIconStr=(value)=>{
//其实它返回的是value,不是event
this.setState({customIconStr:value}) //重新编辑后的值
}
render(){
const {customIconStr} =this.state;
return(
<Paragraph
editable={{
icon: <HighlightOutlined />,
tooltip: '编辑',
onChange: this.setCustomIconStr,
}}
>
{customIconStr}
</Paragraph>
)
}
}
效果图
编辑之前
编辑之后