Skip to content

Commit

Permalink
fix(mis-web): 解决 tab 宽度变化后疯狂抖动的问题 (#992)
Browse files Browse the repository at this point in the history
tab 宽度变化后 antd tab 组件计算宽度有误导致了 tab 组件疯狂抖动。暂时用 hack 的方式阻止了抖动
抖动的原因是 ant-tabs-nav-operations 的 position 属性在 absolute 和 static
间来回切换。这个属性主要是控制标签过多时的滚动和下拉菜单。 SCOW 暂时 tab 过多的情况,所以 hack 下直接设置该元素
display: none
  • Loading branch information
Miracle575 authored Nov 21, 2023
1 parent 04e5d68 commit b84e4f9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/wet-chefs-stare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@scow/lib-web": patch
---

暂时解决 tab 标签在最右侧时的抖动问题
11 changes: 9 additions & 2 deletions libs/web/src/components/FilterFormContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ export const FilterFormContainer = styled.div`
margin: 4px;
max-width: 100%;
}
`;

const NoShakeTab = styled(Tabs)`
.ant-tabs-nav-operations {
display: none !important;
}
`;

const TabFormContainer = styled.div`
Expand All @@ -41,7 +48,7 @@ export const FilterFormTabs: React.FC<TabbedFilterFormProps> = ({
button, tabs, onChange,
}) => {
return (
<Tabs
<NoShakeTab
defaultActiveKey={tabs.length > 0 ? tabs[0].title : ""}
size="small"
tabBarExtraContent={button}
Expand All @@ -56,6 +63,6 @@ export const FilterFormTabs: React.FC<TabbedFilterFormProps> = ({
</Tabs.TabPane>
))
}
</Tabs>
</NoShakeTab>
);
};

0 comments on commit b84e4f9

Please sign in to comment.