0.2.6 • Published 2 years ago

dynamic-tag v0.2.6

Weekly downloads
2
License
MIT
Repository
-
Last release
2 years ago

dynamic-tag

标签编辑器

可对多个标签进行编辑或新增删除,支持字符串数组或对象数组,拖动排序等。双击即可编辑已有标签,费编辑状态下拖动排序。

引入

yarn add dynamic-tag
npm i dynamic-tag

依赖项:element-ui

使用

<dynamic-tag v-model="tags" :type="['', 'danger']" @change="onChange" @close="onClose" />

import DynamicTag from 'dynamic-tag'
export default {
  components: { DynamicTag },
  data () {
    return {
      tags: ['asd', '和人', '但是公司的']
    }
  },
  methods: {
    onClose () {
      console.log('删除标签')
    },
    onChange () {
      console.log(this.tags)
      this.$forceUpdate()
    }
  }
}

参数

参数说明类型可选值默认值
maxlength每个标签最多字符数Number String--10
count标签最多个数Number String--8
type标签样式String Array'' 'danger' 'success' 'info' 'warning' 如果为数组,将会在多个颜色中循环使用''
addible是否可以新增Booleantrue falsetrue
editable是否可以编辑Booleantrue falsetrue
closable是否可以删除Booleantrue falsetrue
disabled是否禁用Booleantrue falsefalse
addName新增按钮名称String'''+ 新增标签'
objectKey对象键名,当绑定的值为对象数组时必填String''''
drag是否开启拖拽排序Booleantrue falsetrue

Methods

方法名参数说明
close-参数关闭时回调
change-数据改变时回调
0.2.6

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago