Skip to content

Commit be73d02

Browse files
authored
fix(TabBar): fix icon slot invalid (#2820) (#2821)
1 parent aa1308d commit be73d02

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/tab-bar-item/tab-bar-item.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@
7474
// }
7575
}
7676

77+
&__icon:empty {
78+
display: none;
79+
}
80+
7781
&__text {
7882
display: flex;
7983
align-items: center;

src/tab-bar-item/tab-bar-item.wxml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
aria-label="{{ ariaLabel || (badgeProps.dot || badgeProps.count ? _.getBadgeAriaLabel({ ...badgeProps }) : '') }}"
1717
>
1818
<view
19-
wx:if="{{icon}}"
2019
class="{{classPrefix}}__icon"
2120
style="height: {{iconOnly ? 24 : 20}}px"
2221
aria-hidden="{{ badgeProps.dot || badgeProps.count }}"
@@ -34,7 +33,7 @@
3433
>
3534
<template is="icon" data="{{ size: iconOnly ? 24 : 20, ..._icon }}" />
3635
</t-badge>
37-
<template wx:else is="icon" data="{{ ariaHidden: !iconOnly, size: iconOnly ? 24 : 20, ..._icon }}" />
36+
<template wx:elif="{{!!icon}}" is="icon" data="{{ ariaHidden: !iconOnly, size: iconOnly ? 24 : 20, ..._icon }}" />
3837
<slot name="icon" />
3938
</view>
4039
<view class="{{_.cls(classPrefix + '__text', [['small', !!icon]])}}">

0 commit comments

Comments
 (0)