V1.0.0
Skip to content

WTag 组件

标签组件,基于 WinDesignNext WTag 封装,用于展示标记和分类信息。

基础用法

Props API

属性名类型默认值说明
idstring-组件唯一标识(必填)
componentstringWTag组件类型(必填)
typestringobject''
sizestring''标签尺寸
effectstring'light'标签效果
closablebooleanfalse是否可关闭
roundbooleanfalse是否圆角
hitbooleanfalse是否有边框描边
disableTransitionsbooleanfalse是否禁用过渡动画
childstring-子组件 ID(标签内容)

path 支持说明

通用绑定格式见 path 数据绑定速查

属性支持 path说明
type动态标签类型(含 @row.tagType 作用域)
size / effect / closable静态配置

绑定示例:

json
{ "type": { "path": "@row.tagType" }, "child": "status-tag-text" }

effect 效果

说明
light浅色背景
dark深色背景
plain朴素样式

使用示例

基础标签

json
{
  "id": "tag_001",
  "component": "WTag",
  "type": "success",
  "size": "small",
  "effect": "light",
  "child": "tag_001_text"
}

数据驱动标签类型

在列表、单选框、复选框等数据驱动场景中,type 可通过数据绑定动态设置:

json
{
  "id": "status-tag",
  "component": "WTag",
  "type": { "path": "@row.tagType" },
  "child": "status-tag-text"
}

对应数据中每项可指定不同的 tagType

json
[
  { "label": "已完成", "tagType": "success" },
  { "label": "进行中", "tagType": "warning" },
  { "label": "已驳回", "tagType": "danger" }
]