mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-24 15:46:10 +08:00
648 B
648 B
order | title | ||||
---|---|---|---|---|---|
3 |
|
zh-CN
受控模式.
en-US
Controlled mode.
import { Mention } from 'antd';
const { toEditorState } = Mention;
class App extends React.Component {
state = {
value: toEditorState('@afc163'),
}
handleChange = (editorState) => {
this.setState({
value: editorState,
});
}
render() {
return (
<Mention
suggestions={['afc163', 'benjycui', 'yiminghe', 'RaoHai', '中文', 'にほんご']}
value={this.state.value}
onChange={this.handleChange}
/>
);
}
}
ReactDOM.render(<App />, mountNode);