Skip to content

Commit

Permalink
feat: button 支持 suffix、tag、href api
Browse files Browse the repository at this point in the history
  • Loading branch information
honkinglin committed Jul 18, 2022
1 parent b3fbb8e commit e16446d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/button/button.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
block | Boolean | false | 是否为块级元素 | N
children | TNode | - | 按钮内容,同 content。TS 类型:`string | TNode`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
content | TNode | - | 按钮内容。TS 类型:`string | TNode`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
disabled | Boolean | false | 禁用状态 | N
disabled | Boolean | - | 禁用状态 | N
ghost | Boolean | false | 是否为幽灵按钮(镂空按钮) | N
href | String | - | 跳转地址。href 存在时,按钮标签默认使用 `<a>` 渲染;如果指定了 `tag` 则使用指定的标签渲染 | N
icon | TElement | - | 按钮内部图标,可完全自定义。TS 类型:`TNode`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
loading | Boolean | false | 是否显示为加载状态 | N
shape | String | rectangle | 按钮形状,有 4 种:长方形、正方形、圆角长方形、圆形。可选项:rectangle/square/round/circle | N
size | String | medium | 组件尺寸。可选项:small/medium/large。TS 类型:`SizeEnum`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
suffix | TElement | - | 右侧内容,可用于定义右侧图标。TS 类型:`TNode`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
tag | String | - | 渲染按钮的 HTML 标签,默认使用标签 `<button>` 渲染,可以自定义为 `<a>` `<div>` 等。透传全部 HTML 属性,如:`href/target/data-*` 等。可选项:button/a/div | N
tag | String | - | 渲染按钮的 HTML 标签,默认使用标签 `<button>` 渲染,可以自定义为 `<a>` `<div>` 等。透传全部 HTML 属性,如:`href/target/data-*` 等。⚠️ 禁用按钮 `<button disabled>`无法显示 Popup 浮层信息,可通过修改 `tag=div` 解决这个问题。可选项:button/a/div | N
theme | String | - | 组件风格,依次为默认色、品牌色、危险色、警告色、成功色。可选项:default/primary/danger/warning/success | N
type | String | button | 按钮类型。可选项:submit/reset/button | N
variant | String | base | 按钮形式,基础、线框、虚线、文字。可选项:base/outline/dashed/text | N
Expand Down
3 changes: 1 addition & 2 deletions src/button/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export interface TdButtonProps {
content?: TNode;
/**
* 禁用状态
* @default false
*/
disabled?: boolean;
/**
Expand Down Expand Up @@ -60,7 +59,7 @@ export interface TdButtonProps {
*/
suffix?: TElement;
/**
* 渲染按钮的 HTML 标签,默认使用标签 `<button>` 渲染,可以自定义为 `<a>` `<div>` 等。透传全部 HTML 属性,如:`href/target/data-*` 等
* 渲染按钮的 HTML 标签,默认使用标签 `<button>` 渲染,可以自定义为 `<a>` `<div>` 等。透传全部 HTML 属性,如:`href/target/data-*` 等。⚠️ 禁用按钮 `<button disabled>`无法显示 Popup 浮层信息,可通过修改 `tag=div` 解决这个问题
*/
tag?: 'button' | 'a' | 'div';
/**
Expand Down
2 changes: 1 addition & 1 deletion src/popconfirm/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export interface TdPopconfirmProps {

export interface PopconfirmVisibleChangeContext {
trigger?: TriggerSource;
e?: MouseEvent<HTMLDivElement | HTMLButtonElement>;
e?: MouseEvent<HTMLElement>;
}

export type TriggerSource = 'cancel' | 'confirm' | 'document' | 'trigger-element-click';

0 comments on commit e16446d

Please sign in to comment.