Skip to content

InputTag 标签输入

标签输入组件,支持动态添加和删除标签。

💡 使用场景:在角色管理中配置权限标识、文章管理中添加标签等。

基本用法

vue
<template>
  <InputTag v-model="tags" />
</template>

<script setup lang="ts">
const tags = ref(['Vue', 'React', 'Angular'])
</script>

自定义配置

vue
<template>
  <InputTag v-model="tags" :config="config" />
</template>

<script setup lang="ts">
const tags = ref([])

const config = {
  buttonAttrs: {
    btnText: '+ 添加标签',
    type: 'primary',
    size: 'small'
  },
  tagAttrs: {
    type: 'success',
    effect: 'plain'
  }
}
</script>

Props

参数说明类型默认值
modelValue标签数组(支持 v-model)string[][]
config配置项Config-

Config 配置

参数说明类型
buttonAttrs添加按钮属性object
buttonAttrs.btnText按钮文本string
inputAttrs输入框属性object
tagAttrs标签属性object

功能特性

  • ✅ 双向绑定
  • ✅ 动态添加标签
  • ✅ 删除标签
  • ✅ 自定义样式

使用场景

  • 文章标签
  • 技能标签
  • 关键词输入

相关链接

基于 MIT 许可发布