Skip to content

Commit

Permalink
feat(tag): feat(tag):修复tag API顺序问题
Browse files Browse the repository at this point in the history
  • Loading branch information
raylotan committed Aug 8, 2024
1 parent 6f39e73 commit 8dd010e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
10 changes: 5 additions & 5 deletions src/tag/tag.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ content | TNode | - | 组件子元素。TS 类型:`string \| TNode`。[通用
disabled | Boolean | false | 标签禁用态,失效标签不能触发事件。默认风格(theme=default)才有禁用态 | N
icon | TElement | undefined | 标签中的图标,可自定义图标呈现。TS 类型:`TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
maxWidth | String / Number | - | 标签最大宽度,宽度超出后会出现省略号。示例:'50px' / 80 | N
onClick | Function | - | 点击时触发。TS 类型:`(content: { e: MouseEvent}) => void` | N
onClose | Function | - | 如果关闭按钮存在,点击关闭按钮时触发。TS 类型:`(content: { e: MouseEvent}) => void` | N
shape | String | square | 标签类型,有三种:方形、圆角方形、标记型。可选项:square/round/mark | N
size | String | medium | 标签尺寸。可选项:small/medium/large/extra-large | N
theme | String | default | 组件风格,用于描述组件不同的应用场景。可选项:default/primary/warning/danger/success | N
variant | String | dark | 标签风格变体。可选项:dark/light/outline/light-outline | N
onClick | Function | | TS 类型:`(context: { e: MouseEvent }) => void`<br/>点击时触发 | N
onClose | Function | | TS 类型:`(context: { e: MouseEvent }) => void`<br/>如果关闭按钮存在,点击关闭按钮时触发 | N


### CheckTag Props
Expand All @@ -35,9 +35,9 @@ content | TNode | - | 组件子元素;传入数组时:[选中内容,非选
defaultChecked | Boolean | - | 标签选中的状态,默认风格(theme=default)才有选中态。非受控属性 | N
disabled | Boolean | false | 标签禁用态,失效标签不能触发事件。默认风格(theme=default)才有禁用态 | N
icon | TElement | - | 标签中的图标,可自定义图标呈现。TS 类型:`TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
onChange | Function | - | 状态切换时触发。TS 类型:`(context: { e: MouseEvent }) => void` | N
onClick | Function | - | 点击标签时触发。TS 类型:`(context: { e: MouseEvent }) => void` | N
onClose | Function | - | 如果关闭按钮存在,点击关闭按钮时触发。TS 类型:`(context: { e: MouseEvent }) => void` | N
shape | String | square | 标签类型,有三种:方形、圆角方形、标记型。。可选项:square/round/mark | N
size | String | medium | 标签尺寸。可选项:small/medium/large。TS 类型:`SizeEnum`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
variant | String | dark | 标签风格变体。可选项:dark/light/outline/light-outline | N
onChange | Function | | TS 类型:`(checked: boolean) => void`<br/>状态切换时触发 | N
onClick | Function | | TS 类型:`(context: { e: MouseEvent }) => void`<br/>点击标签时触发 | N
onClose | Function | | TS 类型:`(context: { e: MouseEvent }) => void`<br/>如果关闭按钮存在,点击关闭按钮时触发 | N
40 changes: 20 additions & 20 deletions src/tag/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,6 @@ export interface TdTagProps {
* 标签最大宽度,宽度超出后会出现省略号。示例:'50px' / 80
*/
maxWidth?: string | number;
/**
* 点击时触发
*/
onClick?: (content: { e: MouseEvent }) => void;
/**
* 如果关闭按钮存在,点击关闭按钮时触发
*/
onClose?: (content: { e: MouseEvent }) => void;
/**
* 标签类型,有三种:方形、圆角方形、标记型
* @default square
Expand All @@ -62,6 +54,14 @@ export interface TdTagProps {
* @default dark
*/
variant?: 'dark' | 'light' | 'outline' | 'light-outline';
/**
* 点击时触发
*/
onClick?: (context: { e: MouseEvent<HTMLDivElement> }) => void;
/**
* 如果关闭按钮存在,点击关闭按钮时触发
*/
onClose?: (context: { e: MouseEvent<HTMLDivElement> }) => void;
}

export interface TdCheckTagProps {
Expand Down Expand Up @@ -95,18 +95,6 @@ export interface TdCheckTagProps {
* 标签中的图标,可自定义图标呈现
*/
icon?: TElement;
/**
* 状态切换时触发
*/
onChange?: (context: { e: MouseEvent }) => void;
/**
* 点击标签时触发
*/
onClick?: (context: { e: MouseEvent }) => void;
/**
* 如果关闭按钮存在,点击关闭按钮时触发
*/
onClose?: (context: { e: MouseEvent }) => void;
/**
* 标签类型,有三种:方形、圆角方形、标记型。
* @default square
Expand All @@ -122,4 +110,16 @@ export interface TdCheckTagProps {
* @default dark
*/
variant?: 'dark' | 'light' | 'outline' | 'light-outline';
/**
* 状态切换时触发
*/
onChange?: (checked: boolean) => void;
/**
* 点击标签时触发
*/
onClick?: (context: { e: MouseEvent<HTMLDivElement> }) => void;
/**
* 如果关闭按钮存在,点击关闭按钮时触发
*/
onClose?: (context: { e: MouseEvent<HTMLDivElement> }) => void;
}

0 comments on commit 8dd010e

Please sign in to comment.