Skip to content

Commit

Permalink
fix(layout): 🐛 [layout] tabs size="small"
Browse files Browse the repository at this point in the history
  • Loading branch information
jsxiaosi committed Dec 18, 2022
1 parent 721bd47 commit 7517410
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/layout/components/AppMain/AppMain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ const { Content } = Layout;

const AppMain = memo(() => {
const isKeepAlive = true;
const maxLen = 10;
return (
<Content css={getAppMainStyle()}>
<TabsPage />
<TabsPage maxLen={maxLen} />
<div className="main-content">
{isKeepAlive ? (
<KeepAlive />
<KeepAlive maxLen={maxLen} />
) : (
<Suspense fallback={<LayoutSpin />}>
<Outlet />
Expand Down
1 change: 0 additions & 1 deletion src/layout/components/AppMain/KeepAlive/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { useAppSelector } from '@/store/hooks';
import LayoutSpin from '@/components/LayoutSpin';

interface Props extends ComponentReactElement {
include?: Array<string>;
maxLen?: number;
}
export const KeepAlive = memo(({ maxLen = 10 }: Props) => {
Expand Down
7 changes: 6 additions & 1 deletion src/layout/components/AppMain/TabsPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import { findRouteByPath, routeListToMenu } from '@/router/utils';
import { setStoreMultiTabs } from '@/store/modules/route';
import defaultRoute from '@/router/modules';

const TabsPage = memo(() => {
interface Props {
maxLen?: number;
}

const TabsPage = memo((_props: Props) => {
const location = useLocation();
const navigate = useNavigate();
const dispatch = useAppDispatch();
Expand Down Expand Up @@ -67,6 +71,7 @@ const TabsPage = memo(() => {
return (
<Tabs
hideAdd
size="small"
activeKey={location.pathname}
type={tabsItem.length > 1 ? 'editable-card' : 'card'}
onChange={(key) => navigate(key)}
Expand Down

0 comments on commit 7517410

Please sign in to comment.