Tags标记模块
通过诸多示例详细展示Tags模块核心参数的使用效果以及Tags模块自身的内部变量和操作方法;另外包括演示模块常规特性,包括事件监听、等待执行、缓存数据、销毁和初始化等。
简单使用
对某标签应用ax-tags
属性后,获得标记组的方法有两种:
- 直接将多个标记以英文逗号分隔写入标签内
- 使用content参数,将多个以英文逗号分隔的文本写入content参数
也可以通过id+new
的方式创建实例。
-
-
-
new ax.Tags('#demo01');
new ax.Tags('#demo02',{
content:'中国,美国,澳大利亚,俄罗斯'
});
数据源配置
属性 |
类型 |
默认值 |
说明 |
content |
string |
'' |
数据源内容 |
contType |
'text'/'async'/'html'/'auto'/'' |
'text' |
内容类型 |
contData |
object |
{} |
请求数据参数 |
ajax |
object |
{} |
异步请求配置 |
field |
string |
'label' |
显示字段名 |
separator |
string |
',' |
数据分隔符 |
外观配置
属性 |
类型 |
默认值 |
说明 |
theme |
'prim'/'succ'/'error'/'warn'/'issue'/'info'/'text'/'brief'/'ignore' |
'' |
主题风格 |
size |
'sm'/'md'/'lg' |
'md' |
标签尺寸 |
type |
'borderless'/'plain'/'' |
'' |
标签类型 |
compact |
boolean |
false |
是否紧凑边距 |
shape |
'radius'/'round'/'square'/'' |
'' |
边框圆角 |
classes |
string |
'' |
追加样式类 |
数量限制配置
属性 |
类型 |
默认值 |
说明 |
max |
number |
0 |
最大标签数量 |
min |
number |
0 |
最小标签数量 |
sliced |
boolean |
true |
是否截断超出部分 |
唯一性配置
属性 |
类型 |
默认值 |
说明 |
unique.enable |
boolean |
false |
是否要求唯一值 |
unique.refer |
string |
'id' |
重复标识字段 |
unique.template |
string |
'{{this.field}}({{this.key}}:{{this.value}})' |
内容模板 |
空状态配置
属性 |
类型 |
默认值 |
说明 |
empty.enable |
boolean |
true |
是否显示空状态 |
empty.content |
string |
'[空状态文本]' |
空状态内容 |
编辑器配置
属性 |
类型 |
默认值 |
说明 |
editor.enable |
boolean |
false |
是否显示输入框 |
editor.addable |
boolean |
true |
是否可回车添加 |
editor.deletable |
boolean |
true |
是否可删除键删除 |
editor.selector |
string |
'' |
外部编辑器选择器 |
editor.placeholder |
string |
'[提示文本]' |
输入框占位符 |
removable |
boolean |
false |
是否显示关闭按钮 |
等待函数
属性 |
类型 |
默认值 |
说明 |
b4Fill |
function |
null |
填充前等待函数 |
b4Add |
function |
null |
添加前等待函数 |
b4Remove |
function |
null |
删除前等待函数 |
b4Edit |
function |
null |
编辑前等待函数 |
b4Clear |
function |
null |
清除前等待函数 |
回调函数
属性 |
类型 |
默认值 |
说明 |
onAdded |
function |
null |
添加后回调 |
onRemoved |
function |
null |
删除后回调 |
onEdited |
function |
null |
编辑后回调 |
onCleared |
function |
null |
清空后回调 |
onDuplicated |
function |
null |
重复添加回调 |
onRequest |
function |
null |
请求完成回调 |
onOutput |
function |
null |
输出结果回调 |