Skip to content

Commit

Permalink
fix: 修复组件缓存失效
Browse files Browse the repository at this point in the history
  • Loading branch information
lingting committed Apr 27, 2023
1 parent 147e35a commit b9c4d68
Show file tree
Hide file tree
Showing 6 changed files with 3,156 additions and 913 deletions.
118 changes: 59 additions & 59 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,67 +40,67 @@
"not ie <= 10"
],
"dependencies": {
"@ant-design/icons": "^4.5.0",
"@ant-design/pro-descriptions": "^1.9.21",
"@ant-design/pro-form": "^1.43.3",
"@ant-design/pro-layout": "^6.26.0",
"@ant-design/pro-table": "^2.56.3",
"@ant-design/pro-utils": "^1.43.2",
"@umijs/route-utils": "^2.0.3",
"antd": "^4.17.1",
"classnames": "^2.2.6",
"crypto-js": "^4.0.0",
"lodash": "^4.17.11",
"moment": "^2.25.3",
"omit.js": "^2.0.2",
"rc-util": "^5.16.0",
"react": "^17.0.0",
"react-activation": "^0.12.1",
"react-color": "^2.19.3",
"react-copy-to-clipboard": "^5.0.4",
"react-cropper": "^2.1.8",
"cropperjs": "^1.5.12",
"react-dom": "^17.0.0",
"react-helmet-async": "^1.0.4",
"react-transition-group": "^4.4.2",
"umi": "^v3.5.0",
"umi-serve": "^1.9.10",
"wangeditor": "^4.7.8"
"@ant-design/icons": "~4.5.0",
"@ant-design/pro-descriptions": "~1.9.21",
"@ant-design/pro-form": "~1.43.3",
"@ant-design/pro-layout": "~6.26.0",
"@ant-design/pro-table": "~2.56.3",
"@ant-design/pro-utils": "~1.43.2",
"@umijs/route-utils": "~2.0.3",
"antd": "~4.17.1",
"classnames": "~2.2.6",
"crypto-js": "~4.0.0",
"lodash": "~4.17.11",
"moment": "~2.25.3",
"omit.js": "~2.0.2",
"rc-util": "~5.16.0",
"react": "~17.0.0",
"react-activation": "~0.9.0",
"react-color": "~2.19.3",
"react-copy-to-clipboard": "~5.0.4",
"react-cropper": "~2.1.8",
"cropperjs": "~1.5.12",
"react-dom": "~17.0.0",
"react-helmet-async": "~1.0.4",
"react-transition-group": "~4.4.2",
"umi": "~v3.5.0",
"umi-serve": "~1.9.10",
"wangeditor": "~4.7.8"
},
"devDependencies": {
"@ant-design/pro-cli": "^2.0.2",
"@types/classnames": "^2.2.7",
"@types/crypto-js": "^4.0.1",
"@types/express": "^4.17.0",
"@types/google.maps": "^3.47.1",
"@types/history": "^4.7.2",
"@types/jest": "^26.0.0",
"@types/lodash": "^4.14.144",
"@types/react": "^17.0.0",
"@types/react-color": "^3.0.4",
"@types/react-dom": "^17.0.0",
"@types/react-helmet": "^6.1.0",
"@umijs/fabric": "^2.6.2",
"@umijs/plugin-blocks": "^2.0.5",
"@umijs/plugin-esbuild": "^1.0.1",
"@umijs/preset-ant-design-pro": "^1.2.0",
"@umijs/preset-react": "^1.7.4",
"@umijs/yorkie": "^2.0.3",
"carlo": "^0.9.46",
"cross-env": "^7.0.0",
"cross-port-killer": "^1.1.1",
"detect-installer": "^1.0.1",
"enzyme": "^3.11.0",
"eslint": "^7.32.0",
"express": "^4.17.1",
"gh-pages": "^3.0.0",
"jsdom-global": "^3.0.2",
"lint-staged": "^10.0.0",
"prettier": "^2.0.1",
"puppeteer-core": "^8.0.0",
"stylelint": "^13.0.0",
"typescript": "^4.2.2",
"webpack-sources": "^3.2.3"
"@ant-design/pro-cli": "~2.0.2",
"@types/classnames": "~2.2.7",
"@types/crypto-js": "~4.0.1",
"@types/express": "~4.17.0",
"@types/google.maps": "~3.47.1",
"@types/history": "~4.7.2",
"@types/jest": "~26.0.0",
"@types/lodash": "~4.14.144",
"@types/react": "~17.0.0",
"@types/react-color": "~3.0.4",
"@types/react-dom": "~17.0.0",
"@types/react-helmet": "~6.1.0",
"@umijs/fabric": "~2.6.2",
"@umijs/plugin-blocks": "~2.0.5",
"@umijs/plugin-esbuild": "~1.0.1",
"@umijs/preset-ant-design-pro": "~1.2.0",
"@umijs/preset-react": "~1.7.4",
"@umijs/yorkie": "~2.0.3",
"carlo": "~0.9.46",
"cross-env": "~7.0.0",
"cross-port-killer": "~1.1.1",
"detect-installer": "~1.0.1",
"enzyme": "~3.11.0",
"eslint": "~7.32.0",
"express": "~4.17.1",
"gh-pages": "~3.0.0",
"jsdom-global": "~3.0.2",
"lint-staged": "~10.0.0",
"prettier": "~2.0.1",
"puppeteer-core": "~8.0.0",
"stylelint": "~13.0.0",
"typescript": "~4.2.2",
"webpack-sources": "~3.2.3"
},
"engines": {
"node": ">=10.0.0"
Expand Down
2 changes: 1 addition & 1 deletion src/components/SettingDrawer/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
.@{ant-pro-setting-drawer} {
&-content {
position: relative;
//min-height: 100%;
min-height: 100%;

.ant-pro-setting-drawer-content {
height: 100% !important;
Expand Down
11 changes: 2 additions & 9 deletions src/components/SettingDrawer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ import type { BodyProps, MergerSettingsType, SettingDrawerProps } from './typing
import { LayoutSetting as LayoutSettingUtils } from '@/utils/Ballcat';

export const getFormatMessage = (): ((data: { id: string; defaultMessage?: string }) => string) => {
const formatMessage = ({ id }: { id: string; defaultMessage?: string }): string => {
return ({ id }: { id: string; defaultMessage?: string }): string => {
const locales = getLocales();
return locales[id];
};
return formatMessage;
};

const Body: React.FC<BodyProps> = ({ children, prefixCls, titleKey }) => (
Expand Down Expand Up @@ -182,7 +181,7 @@ const SettingDrawer: React.FC<SettingDrawerProps> = (props) => {
}}
bodyStyle={{ paddingBottom: '0' }}
drawerStyle={{ height: '100%' }}
contentWrapperStyle={{ height: 'auto' }}
contentWrapperStyle={{ height: 'calc(100% - 2px)' }}
>
<div className={`${baseClassName}-drawer-content`}>
<Body titleKey="pagestyle" prefixCls={baseClassName}>
Expand Down Expand Up @@ -235,12 +234,6 @@ const SettingDrawer: React.FC<SettingDrawerProps> = (props) => {
<LayoutSetting settings={layoutSetting} changeSetting={changeSetting} />
<Divider />

{/*<Body titleKey="regionalsettings" prefixCls={baseClassName}>*/}
{/* <RegionalSetting settings={layoutSetting} changeSetting={changeSetting}/>*/}
{/*</Body>*/}

{/*<Divider/>*/}

<Body titleKey="othersettings" prefixCls={baseClassName}>
<List
split={false}
Expand Down
12 changes: 6 additions & 6 deletions src/layouts/BasicLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
siderWidth={isContentFull ? 0 : undefined}
headerHeight={isContentFull ? 0 : undefined}
headerRender={(headerProps, defaultDom) => (isContentFull ? undefined : defaultDom)}
headerContentRender={(headerViewProps, defaultDom) => {
if (initialState?.settings?.splitMenus) {
return defaultDom;
}

headerContentRender={(headerViewProps) => {
return (
<Header.Left
headerViewProps={headerViewProps}
Expand Down Expand Up @@ -186,7 +182,11 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
content={settings.waterMark ? initialState?.user?.info?.nickname : undefined}
style={{ height: '100%' }}
>
<ReactKeepAlive id={keepAliveProps.id} name={keepAliveProps.name}>
<ReactKeepAlive
key={`keep-alive-${keepAliveProps.id}`}
id={keepAliveProps.id}
name={keepAliveProps.name}
>
{children}
</ReactKeepAlive>
</WaterMark>
Expand Down
7 changes: 5 additions & 2 deletions src/pages/system/menu/SysMenuPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { ProFormRadio, ProFormSelect, ProFormText, ProFormTextArea } from '@ant-
import type { ActionType, ProColumns } from '@ant-design/pro-table';
import { EditableProTable } from '@ant-design/pro-table';
import { Button, Form as AntdForm, message, Modal, TreeSelect, Typography } from 'antd';
import { FormInstance } from 'antd/es';
import type { FormInstance } from 'antd/es';
import { useRef, useState } from 'react';

const isBtn = (data: SysMenuVo | any) => {
Expand Down Expand Up @@ -499,7 +499,10 @@ export default () => {
valueType: 'option',
render: (text, recoed, _, action) => {
return (
<a key="editable" onClick={() => action?.startEditable?.(recoed.id)}>
<a
key={`editable-${recoed.id}`}
onClick={() => action?.startEditable?.(recoed.id)}
>
编辑
</a>
);
Expand Down
Loading

0 comments on commit b9c4d68

Please sign in to comment.