Skip to content

Mention 提及

规则

基础示例

Props 配置示例

多行与自定义前缀

形态示例

整段禁用

尺寸对比(小 / 中 / 大)

Events 事件示例

完整配置项请参考: naive-ui_Mention

value

  • string \| null,一般为输入框中的完整文本。

Options(MentionOption)

字段名说明字段类型
class选项类名string
disabled是否禁用boolean
label展示文案,可为函数或 VNodestring | (option) => VNodeChild
render自定义渲染(option) => VNodeChild
style选项样式string
value唯一值string

Mention Props

名称类型默认值说明
autosizeboolean | { maxRows?, minRows? }false多行自适应
optionsMentionOption[][]候选列表
type'text' | 'textarea''text'输入类型
separatorstring' '切分提及的字符,长度须为 1
borderedbooleantrue是否显示边框
disabledbooleanfalse是否禁用
defaultValuestring''非受控默认值
filter(pattern, option) => boolean内置自定义过滤(2.38.2+)
loadingbooleanfalse面板加载态
prefixstring | string[]'@'触发前缀,单字符
placeholderstring''占位
placement多种 placement'bottom-start'面板位置(2.25.0+)
renderLabel(option) => VNodeChildundefined自定义选项标签
scrollbarPropsScrollbarPropsundefined滚动条配置(2.44.0+)
size'small' | 'medium' | 'large''medium'尺寸
status'success' | 'warning' | 'error'undefined校验状态(2.27.0+)
tostring | HTMLElement | falsebody面板挂载容器
valuestring | nullundefined受控值
onUpdateShow(show: boolean) => voidundefined面板显隐(2.34.0+)
onUpdateValue(value: string) => voidundefined文本变化
onSelect(option, prefix) => voidundefined选中项
onFocus(e: FocusEvent) => voidundefined聚焦
onSearch(pattern, prefix) => voidundefined搜索
onBlur(e: FocusEvent) => voidundefined失焦

FormCreate 是一个开源项目,基于 MIT 许可证发布,欢迎个人和企业用户免费使用