Skip to content

Commit

Permalink
feat(Fab): add default slot (#3204)
Browse files Browse the repository at this point in the history
  • Loading branch information
anlyyao authored Oct 15, 2024
1 parent becc87a commit 89da488
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/button/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { SuperComponent, wxComponent } from '../common/src/index';
import config from '../common/config';
import props from './props';
import { canIUseFormFieldButton } from '../common/version';
import { setIcon } from '../common/utils';
import { calcIcon } from '../common/utils';
import type { TdButtonProps } from './type';

const { prefix } = config;
Expand Down Expand Up @@ -33,9 +33,8 @@ export default class Button extends SuperComponent {
},

icon(icon) {
const obj = setIcon('icon', icon, '');
this.setData({
...obj,
_icon: calcIcon(icon, ''),
});
},
};
Expand Down
4 changes: 2 additions & 2 deletions src/button/button.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
aria-label="{{ariaLabel}}"
>
<template
wx:if="{{iconName || _.isNoEmptyObj(iconData)}}"
wx:if="{{_icon}}"
is="icon"
data="{{class: classPrefix + '__icon', tClass: prefix + '-class-icon', ariaHidden: true, name: iconName, ...iconData}}"
data="{{class: classPrefix + '__icon', tClass: prefix + '-class-icon', ariaHidden: true, name: iconName, ..._icon}}"
/>
<t-loading
wx:if="{{loading}}"
Expand Down
4 changes: 3 additions & 1 deletion src/common/template/button.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,7 @@
bind:launchapp="onTplButtonTap"
bind:agreeprivacyauthorization="onTplButtonTap"
aria-label="{{ariaLabel || ''}}"
/>
>
<slot />
</t-button>
</template>

0 comments on commit 89da488

Please sign in to comment.