Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tabbar): 修复tabbar红色气泡遮住了底部图标 #2456

Merged
merged 6 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions src/badge/__test__/__snapshots__/demo.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ exports[`Badge Badge base demo works fine 1`] = `
class="wrapper"
content="消息"
dot="{{true}}"
offset="{{
Array [
-4,
4,
]
}}"
/>
<t-badge
class="wrapper"
Expand Down Expand Up @@ -66,7 +60,7 @@ exports[`Badge Badge base demo works fine 1`] = `
count="8"
offset="{{
Array [
-8,
4,
]
}}"
/>
Expand All @@ -75,7 +69,7 @@ exports[`Badge Badge base demo works fine 1`] = `
count="2"
offset="{{
Array [
-2,
2,
-2,
]
}}"
Expand Down Expand Up @@ -193,7 +187,7 @@ exports[`Badge Badge theme demo works fine 1`] = `
count="2"
offset="{{
Array [
-2,
2,
-2,
]
}}"
Expand All @@ -217,7 +211,7 @@ exports[`Badge Badge theme demo works fine 1`] = `
count="2"
offset="{{
Array [
-2,
1,
-2,
]
}}"
Expand Down
2 changes: 0 additions & 2 deletions src/badge/__test__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ describe('badge', () => {

const $count = comp.querySelector('.badge >>> .t-badge--basic');
expect($count.dom.style.top).toBe('20em');
expect($count.dom.style.right).toBe('15px');
});

it(':offset number without unit', async () => {
Expand All @@ -229,6 +228,5 @@ describe('badge', () => {

const $count = comp.querySelector('.badge >>> .t-badge--basic');
expect($count.dom.style.top).toBe('29px');
expect($count.dom.style.right).toBe('16px');
});
});
6 changes: 3 additions & 3 deletions src/badge/_example/base/index.wxml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<view class="demo-desc">红点徽标</view>
<view class="demo-wrapper">
<t-badge dot offset="{{ [-4, 4] }}" class="wrapper" content="消息" />
<t-badge dot class="wrapper" content="消息" />
<t-badge dot offset="{{ [1, -1] }}" class="wrapper">
<t-icon name="notification" size="24" ariaLabel="通知" />
</t-badge>
Expand All @@ -11,8 +11,8 @@

<view class="demo-desc">数字徽标</view>
<view class="demo-wrapper">
<t-badge count="8" content="消息" offset="{{ [-8] }}" class="wrapper" />
<t-badge count="2" offset="{{ [-2, -2] }}" class="wrapper">
<t-badge count="8" content="消息" offset="{{ [4] }}" class="wrapper" />
<t-badge count="2" offset="{{ [2, -2] }}" class="wrapper">
<t-icon name="notification" size="24" ariaLabel="通知" />
</t-badge>
<t-badge count="8" offset="{{ [2, 2] }}" class="wrapper">
Expand Down
4 changes: 2 additions & 2 deletions src/badge/_example/theme/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

<view class="demo-desc">圆形徽标</view>
<view class="demo-wrapper">
<t-badge count="2" offset="{{ [-2, -2] }}">
<t-badge count="2" offset="{{ [2, -2] }}">
<t-icon name="notification" size="24" ariaLabel="通知" />
</t-badge>
</view>

<view class="demo-desc">方形徽标</view>
<view class="demo-wrapper">
<t-badge count="2" shape="square" offset="{{ [-2, -2] }}">
<t-badge count="2" shape="square" offset="{{ [1, -2] }}">
<t-icon name="notification" size="24" ariaLabel="通知" />
</t-badge>
</view>
Expand Down
4 changes: 2 additions & 2 deletions src/badge/badge.less
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@
}

&__content:not(:empty) + .t-has-count {
transform: translate(50%, -50%);
transform: translate(-50%, -50%);
position: absolute;
right: 0;
left: 100%;
anlyyao marked this conversation as resolved.
Show resolved Hide resolved
top: 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/badge/badge.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var getBadgeStyles = function (props) {
styleStr += 'background:' + props.color + ';';
}
if (props.offset[0]) {
styleStr += 'right:' + (hasUnit(props.offset[0].toString()) ? props.offset[0] : props.offset[0] + 'px') + ';';
styleStr += 'left: calc(100% + ' + (hasUnit(props.offset[0].toString()) ? props.offset[0] : props.offset[0] + 'px') + ');';
}
if (props.offset[1]) {
styleStr += 'top:' + (hasUnit(props.offset[1].toString()) ? props.offset[1] : props.offset[1] + 'px') + ';';
Expand Down
4 changes: 0 additions & 4 deletions src/tab-bar-item/tab-bar-item.less
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@
// }
}

.@{prefix}-badge-class {
transform: translate(50%, -10%) !important; // stylelint-disable-line
}

&__text {
display: flex;
align-items: center;
Expand Down
Loading