Skip to content

Commit 5e3b31b

Browse files
authored
fix(drawer): cancel-btn and confirm-btn type supports null (#3612)
1 parent 5d01893 commit 5e3b31b

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/drawer/drawer.en-US.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ name | type | default | description | required
3333
-- | -- | -- | -- | --
3434
attach | String / Function | - | Typescript: `AttachNode`. [see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
3535
body | String / Slot / Function | - | Typescript: `string \| TNode`. [see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
36-
cancelBtn | String / Object / Slot / Function | - | Typescript: `FooterButton` | N
36+
cancelBtn | String / Object / Slot / Function | - | Typescript: `FooterButton` `type FooterButton = string \| ButtonProps \| TNode \| null`[Button API Documents](./button?tab=api). [see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts). [see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/drawer/type.ts) | N
3737
closeBtn | String / Boolean / Slot / Function | - | Typescript: `string \| boolean \| TNode`. [see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
3838
closeOnEscKeydown | Boolean | true | trigger drawer close event on `ESC` keydown | N
3939
closeOnOverlayClick | Boolean | true | \- | N
40-
confirmBtn | String / Object / Slot / Function | - | Typescript: `FooterButton` `type FooterButton = string \| ButtonProps \| TNode`[Button API Documents](./button?tab=api). [see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts). [see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/drawer/type.ts) | N
40+
confirmBtn | String / Object / Slot / Function | - | Typescript: `FooterButton` `type FooterButton = string \| ButtonProps \| TNode \| null`[Button API Documents](./button?tab=api). [see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts). [see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/drawer/type.ts) | N
4141
default | String / Slot / Function | - | Typescript: `string \| TNode`. [see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
4242
destroyOnClose | Boolean | false | \- | N
4343
drawerClassName | String | - | \- | N

src/drawer/drawer.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@
3333
-- | -- | -- | -- | --
3434
attach | String / Function | - | 抽屉挂载的节点,默认挂在组件本身的位置。数据类型为 String 时,会被当作选择器处理,进行节点查询。示例:'body' 或 () => document.body。TS 类型:`AttachNode`[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
3535
body | String / Slot / Function | - | 抽屉内容。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
36-
cancelBtn | String / Object / Slot / Function | - | 取消按钮,可自定义。值为 null 则不显示取消按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 TNode 自定义按钮时,需自行控制取消事件。TS 类型:`FooterButton` | N
36+
cancelBtn | String / Object / Slot / Function | - | 取消按钮,可自定义。值为 null 则不显示取消按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 TNode 自定义按钮时,需自行控制取消事件。TS 类型:`FooterButton` `type FooterButton = string \| ButtonProps \| TNode \| null`[Button API Documents](./button?tab=api)[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts)[详细类型定义](https://github.com/Tencent/tdesign-vue/tree/develop/src/drawer/type.ts) | N
3737
closeBtn | String / Boolean / Slot / Function | - | 关闭按钮,可以自定义。值为 true 显示默认关闭按钮,值为 false 不显示关闭按钮。值类型为 string 则直接显示值,如:“关闭”。值类型为 TNode,则表示呈现自定义按钮示例。TS 类型:`string \| boolean \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
3838
closeOnEscKeydown | Boolean | true | 按下 ESC 时是否触发抽屉关闭事件 | N
3939
closeOnOverlayClick | Boolean | true | 点击蒙层时是否触发抽屉关闭事件 | N
40-
confirmBtn | String / Object / Slot / Function | - | 确认按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 TNode 自定义按钮时,需自行控制确认事件。TS 类型:`FooterButton` `type FooterButton = string \| ButtonProps \| TNode`[Button API Documents](./button?tab=api)[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts)[详细类型定义](https://github.com/Tencent/tdesign-vue/tree/develop/src/drawer/type.ts) | N
40+
confirmBtn | String / Object / Slot / Function | - | 确认按钮。值为 null 则不显示确认按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 TNode 自定义按钮时,需自行控制确认事件。TS 类型:`FooterButton` `type FooterButton = string \| ButtonProps \| TNode \| null`[Button API Documents](./button?tab=api)[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts)[详细类型定义](https://github.com/Tencent/tdesign-vue/tree/develop/src/drawer/type.ts) | N
4141
default | String / Slot / Function | - | 抽屉内容,同 body。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
4242
destroyOnClose | Boolean | false | 抽屉关闭时是否销毁节点 | N
4343
drawerClassName | String | - | 抽屉元素类名。 | N

src/drawer/props.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default {
3434
type: Boolean,
3535
default: true,
3636
},
37-
/** 确认按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 TNode 自定义按钮时,需自行控制确认事件 */
37+
/** 确认按钮,可自定义。值为 null 则不显示确认按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 TNode 自定义按钮时,需自行控制确认事件 */
3838
confirmBtn: {
3939
type: [String, Object, Function] as PropType<TdDrawerProps['confirmBtn']>,
4040
},

src/drawer/type.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export interface TdDrawerProps {
3434
*/
3535
closeOnOverlayClick?: boolean;
3636
/**
37-
* 确认按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 TNode 自定义按钮时,需自行控制确认事件
37+
* 确认按钮,可自定义。值为 null 则不显示确认按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 TNode 自定义按钮时,需自行控制确认事件
3838
*/
3939
confirmBtn?: FooterButton;
4040
/**
@@ -178,7 +178,7 @@ export interface DrawerInstance {
178178
update?: (props: DrawerOptions) => void;
179179
}
180180

181-
export type FooterButton = string | ButtonProps | TNode;
181+
export type FooterButton = string | ButtonProps | TNode | null;
182182

183183
export interface SizeDragLimit {
184184
max: number;

0 commit comments

Comments
 (0)