Skip to content

Commit

Permalink
feat(button): add new prop customDataset
Browse files Browse the repository at this point in the history
  • Loading branch information
anlyyao committed Mar 14, 2022
1 parent 4a9d1a3 commit 2cebf36
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/button/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ isComponent: true
-- | -- | -- | -- | --
block | Boolean | false | 是否为块级元素 | N
content | String / Slot | - | 按钮内容 | N
custom-dataset | Any | - | 自定义 dataset,可通过 event.currentTarget.dataset.custom 获取。TS 类型:`any` | N
disabled | Boolean | false | 是否禁用按钮 | N
external-classes | Array | - | 组件类名。`['t-class', 't-class-icon']` | N
ghost | Boolean | false | 是否为幽灵按钮(镂空按钮) | N
Expand Down
1 change: 1 addition & 0 deletions src/button/button.wxml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<button
data-custom="{{ customDataset }}"
class="{{className}} {{prefix}}-class"
form-type="{{type}}"
open-type="{{disabled ? '' : openType}}"
Expand Down
4 changes: 4 additions & 0 deletions src/button/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ const props: TdButtonProps = {
content: {
type: String,
},
/** 自定义 dataset,可通过 event.currentTarget.dataset.custom 获取 */
customDataset: {
type: null,
},
/** 是否禁用按钮 */
disabled: {
type: Boolean,
Expand Down
8 changes: 8 additions & 0 deletions src/button/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ export interface TdButtonProps {
value?: string;
required?: boolean;
};
/**
* 自定义 dataset,可通过 event.currentTarget.dataset.custom 获取
*/
customDataset?: {
type: ObjectConstructor;
value?: any;
required?: boolean;
};
/**
* 是否禁用按钮
* @default false
Expand Down

0 comments on commit 2cebf36

Please sign in to comment.