Skip to content

TagInput 标签输入框

规则

基础示例

Props 配置示例

限制标签数量

禁用状态

尺寸对比(小 / 中 / 大)

Events 事件示例

监听标签变化

完整配置项:TDesign_Tag_Input

valueArray<string | number>

Props

参数说明类型默认值版本
autoWidth宽度随内容自适应booleanfalse-
borderless无边框模式booleanfalse-
clearable是否可清空booleanfalse-
collapsedItems标签过多时折叠项自定义TNode<{ value; collapsedSelectedItems; count; onClose }>--
disabled是否禁用boolean--
dragSort拖拽调整标签顺序booleanfalse-
excessTagsDisplayType标签超出呈现方式scroll | break-linebreak-line-
inputProps透传 Input 属性InputProps--
inputValue输入框值(v-model:inputValue)string''-
defaultInputValue非受控输入框值string''-
label左侧文本string | TNode--
max最大标签数量number--
minCollapsedNum折叠阈值(0 不折叠)number0-
placeholder占位符string--
prefixIcon前置图标TNode--
readonly只读boolean--
size尺寸small | medium | largemedium-
status状态default | success | warning | error--
suffix后置内容string | TNode--
suffixIcon后置图标TNode--
tag自定义单个标签内容string | TNode<{ value }>--
tagProps透传 Tag 属性TagProps--
tips下方提示文本string | TNode--
value标签值Array<string | number>[]-
defaultValue非受控标签值Array<string | number>[]-
valueDisplay自定义全部标签呈现string | TNode<{ value; onClose }>--

Events

事件说明类型版本
blur失去焦点(value, context: { inputValue: string; e: FocusEvent }) => void-
change值变化(value, context: TagInputChangeContext) => void-
clear清空(context: { e: MouseEvent }) => void-
click点击(context: { e: MouseEvent }) => void-
dragSort拖拽排序(开发中)(context: TagInputDragSortContext) => void-
enter回车(value, context: { e: KeyboardEvent; inputValue: string }) => void-
focus聚焦(value, context: { inputValue: string; e: FocusEvent }) => void-
inputChange输入框值变化(value: string, context?: InputValueChangeContext) => void-
mouseenter鼠标进入(context: { e: MouseEvent }) => void-
mouseleave鼠标离开(context: { e: MouseEvent }) => void-
paste粘贴(context: { e: ClipboardEvent; pasteValue: string }) => void-
remove移除单个标签(context: TagInputRemoveContext) => void-

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