Mention 提及
规则
基础示例
Props 配置示例
多行与自定义前缀
异步搜索(配合 on.search)
形态示例
整段禁用
尺寸对比(小 / 中 / 大)
Events 事件示例
完整配置项请参考: naive-ui_Mention
value
string \| null,一般为输入框中的完整文本。
Options(MentionOption)
| 字段名 | 说明 | 字段类型 |
|---|---|---|
| class | 选项类名 | string |
| disabled | 是否禁用 | boolean |
| label | 展示文案,可为函数或 VNode | string | (option) => VNodeChild |
| render | 自定义渲染 | (option) => VNodeChild |
| style | 选项样式 | string |
| value | 唯一值 | string |
Mention Props
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| autosize | boolean | { maxRows?, minRows? } | false | 多行自适应 |
| options | MentionOption[] | [] | 候选列表 |
| type | 'text' | 'textarea' | 'text' | 输入类型 |
| separator | string | ' ' | 切分提及的字符,长度须为 1 |
| bordered | boolean | true | 是否显示边框 |
| disabled | boolean | false | 是否禁用 |
| defaultValue | string | '' | 非受控默认值 |
| filter | (pattern, option) => boolean | 内置 | 自定义过滤(2.38.2+) |
| loading | boolean | false | 面板加载态 |
| prefix | string | string[] | '@' | 触发前缀,单字符 |
| placeholder | string | '' | 占位 |
| placement | 多种 placement | 'bottom-start' | 面板位置(2.25.0+) |
| renderLabel | (option) => VNodeChild | undefined | 自定义选项标签 |
| scrollbarProps | ScrollbarProps | undefined | 滚动条配置(2.44.0+) |
| size | 'small' | 'medium' | 'large' | 'medium' | 尺寸 |
| status | 'success' | 'warning' | 'error' | undefined | 校验状态(2.27.0+) |
| to | string | HTMLElement | false | body | 面板挂载容器 |
| value | string | null | undefined | 受控值 |
| onUpdateShow | (show: boolean) => void | undefined | 面板显隐(2.34.0+) |
| onUpdateValue | (value: string) => void | undefined | 文本变化 |
| onSelect | (option, prefix) => void | undefined | 选中项 |
| onFocus | (e: FocusEvent) => void | undefined | 聚焦 |
| onSearch | (pattern, prefix) => void | undefined | 搜索 |
| onBlur | (e: FocusEvent) => void | undefined | 失焦 |


