2016-07-04 10:31:27 +08:00
|
|
|
|
---
|
|
|
|
|
category: Components
|
|
|
|
|
chinese: 提及
|
|
|
|
|
cols: 1
|
|
|
|
|
type: Views
|
|
|
|
|
english: Mention
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
Mention component。
|
|
|
|
|
|
|
|
|
|
## When To Use
|
|
|
|
|
|
|
|
|
|
When need to mention someone or something.
|
|
|
|
|
|
2016-07-21 15:41:40 +08:00
|
|
|
|
## API
|
|
|
|
|
|
2016-07-21 15:23:04 +08:00
|
|
|
|
```jsx
|
|
|
|
|
<Mention
|
|
|
|
|
onChange={onChange}
|
|
|
|
|
suggestions={['afc163', 'benjycui', 'yiminghe', 'jljsj33', 'dqaria', 'RaoHai']}
|
|
|
|
|
/>
|
2016-07-04 10:31:27 +08:00
|
|
|
|
```
|
|
|
|
|
|
2016-07-20 18:56:44 +08:00
|
|
|
|
### Mention API
|
|
|
|
|
|
2016-07-21 15:23:04 +08:00
|
|
|
|
| API | Description | Type |
|
2016-07-20 18:56:44 +08:00
|
|
|
|
|----------|---------------|----------|--------------|
|
|
|
|
|
| toString | convert EditorState to string | Function(editorState: EditorState): String |
|
|
|
|
|
| toEditorState | convert string to EditorState | Function(string: String): EditorState |
|
|
|
|
|
| getMentions | get mentioned people in current editorState | Function(editorState: EditorState): Array<String> |
|
|
|
|
|
|
|
|
|
|
|
2016-07-04 10:31:27 +08:00
|
|
|
|
### Mention props
|
|
|
|
|
|
|
|
|
|
| Property | Description | Type | Default |
|
|
|
|
|
|----------|---------------|----------|--------------|
|
|
|
|
|
| suggestions | suggestion content | Array<string> or Array<Mention.Nav> | [] |
|
2016-08-29 14:46:31 +08:00
|
|
|
|
| suggestionStyle | style of suggestion container | Object | {} |
|
2016-07-04 10:31:27 +08:00
|
|
|
|
| onSearchChange | Callback function called when search content changes | function(value:String) | [] |
|
2016-07-19 13:39:05 +08:00
|
|
|
|
| onChange | Callback function called when content of input changes | function(editorState: EditorState) | null |
|
2016-07-04 10:31:27 +08:00
|
|
|
|
| notFoundContent| suggestion when suggestions empty | string | '无匹配结果,轻敲空格完成输入' |
|
|
|
|
|
| loading | loading mode | boolean | false |
|
|
|
|
|
| multiLines | multilines mode | boolean | false |
|
2016-07-19 13:39:05 +08:00
|
|
|
|
| defaultValue | default value | EditorState, you can use `Mention.toEditorState` to convert text to `EditorState` | null |
|
2016-07-18 16:58:08 +08:00
|
|
|
|
| value | core state of mention | EditorState | null |
|
2016-07-04 10:31:27 +08:00
|
|
|
|
|
|
|
|
|
### Nav props
|
|
|
|
|
|
|
|
|
|
| Property | Description | Type | Default |
|
|
|
|
|
|----------|---------------|----------|--------------|
|
|
|
|
|
| value | value of suggestion,the value will insert into input filed while selected | string | "" |
|
|
|
|
|
| children | suggestion content | Objet | {} |
|