mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-29 05:29:37 +08:00
parent
58d98a7802
commit
05c6d09eab
41
components/mention/demo/controllder-simple.md
Normal file
41
components/mention/demo/controllder-simple.md
Normal file
@ -0,0 +1,41 @@
|
||||
---
|
||||
order: 3
|
||||
title:
|
||||
zh-CN: 受控模式
|
||||
en-US: Controlled
|
||||
---
|
||||
|
||||
## zh-CN
|
||||
|
||||
受控模式.
|
||||
|
||||
## en-US
|
||||
|
||||
Controlled mode.
|
||||
|
||||
````jsx
|
||||
import { Mention } from 'antd';
|
||||
const { toEditorState } = Mention;
|
||||
|
||||
const App = React.createClass({
|
||||
getInitialState() {
|
||||
return {
|
||||
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);
|
||||
````
|
@ -1,8 +1,8 @@
|
||||
---
|
||||
order: 3
|
||||
order: 4
|
||||
title:
|
||||
zh-CN: 受控模式
|
||||
en-US: Controlled
|
||||
zh-CN: 配合 Form 使用
|
||||
en-US: With Form
|
||||
---
|
||||
|
||||
## zh-CN
|
||||
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
order: 4
|
||||
order: 5
|
||||
title:
|
||||
zh-CN: 多行
|
||||
en-US: Multi-lines Mode
|
||||
|
Loading…
Reference in New Issue
Block a user