TagInput 标签输入框
规则
基础示例
Props 配置示例
限制标签数量
禁用状态
尺寸对比(小 / 中 / 大)
Events 事件示例
监听标签变化
完整配置项:TDesign_Tag_Input
value:Array<string | number>
Props
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|---|---|---|---|---|
| autoWidth | 宽度随内容自适应 | boolean | false | - |
| borderless | 无边框模式 | boolean | false | - |
| clearable | 是否可清空 | boolean | false | - |
| collapsedItems | 标签过多时折叠项自定义 | TNode<{ value; collapsedSelectedItems; count; onClose }> | - | - |
| disabled | 是否禁用 | boolean | - | - |
| dragSort | 拖拽调整标签顺序 | boolean | false | - |
| excessTagsDisplayType | 标签超出呈现方式 | scroll | break-line | break-line | - |
| inputProps | 透传 Input 属性 | InputProps | - | - |
| inputValue | 输入框值(v-model:inputValue) | string | '' | - |
| defaultInputValue | 非受控输入框值 | string | '' | - |
| label | 左侧文本 | string | TNode | - | - |
| max | 最大标签数量 | number | - | - |
| minCollapsedNum | 折叠阈值(0 不折叠) | number | 0 | - |
| placeholder | 占位符 | string | - | - |
| prefixIcon | 前置图标 | TNode | - | - |
| readonly | 只读 | boolean | - | - |
| size | 尺寸 | small | medium | large | medium | - |
| 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 | - |


