2016-03-31 14:17:09 +08:00
|
|
|
---
|
|
|
|
category: Components
|
2016-09-21 11:28:38 +08:00
|
|
|
subtitle: 标签
|
2018-11-04 16:20:35 +08:00
|
|
|
type: 数据展示
|
2016-09-21 11:28:38 +08:00
|
|
|
title: Tag
|
2020-06-05 13:50:09 +08:00
|
|
|
cover: https://gw.alipayobjects.com/zos/alicdn/cH1BOLfxC/Tag.svg
|
2016-03-31 14:17:09 +08:00
|
|
|
---
|
2015-07-22 11:06:55 +08:00
|
|
|
|
2015-07-28 20:15:25 +08:00
|
|
|
进行标记和分类的小标签。
|
|
|
|
|
|
|
|
## 何时使用
|
|
|
|
|
|
|
|
- 用于标记事物的属性和维度。
|
|
|
|
- 进行分类。
|
|
|
|
|
|
|
|
## API
|
|
|
|
|
2016-11-10 11:14:03 +08:00
|
|
|
### Tag
|
|
|
|
|
2021-03-01 19:20:48 +08:00
|
|
|
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
|
|
|
| --- | --- | --- | --- | --- |
|
2021-04-01 11:26:39 +08:00
|
|
|
| closable | 标签是否可以关闭(点击默认关闭) | boolean | false | |
|
2021-03-01 19:20:48 +08:00
|
|
|
| closeIcon | 自定义关闭按钮 | ReactNode | - | 4.4.0 |
|
|
|
|
| color | 标签色 | string | - | |
|
|
|
|
| icon | 设置图标 | ReactNode | - | |
|
2021-05-25 15:31:50 +08:00
|
|
|
| onClose | 关闭时的回调(可通过 `e.preventDefault()` 来阻止默认行为) | (e) => void | - | |
|
2016-11-10 11:14:03 +08:00
|
|
|
|
|
|
|
### Tag.CheckableTag
|
|
|
|
|
2022-08-15 14:39:02 +08:00
|
|
|
| 参数 | 说明 | 类型 | 默认值 |
|
|
|
|
| -------- | -------------------- | ----------------- | ------ |
|
|
|
|
| checked | 设置标签的选中状态 | boolean | false |
|
|
|
|
| onChange | 点击标签时触发的回调 | (checked) => void | - |
|