Skip to content

Commit 1afae39

Browse files
authored
feat: use the BackTop from antd (#14)
* feat: use the BackTop from antd
1 parent 3acef3b commit 1afae39

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

src/layout/index.tsx

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import React from 'react';
22
import ProCard from '@ant-design/pro-card';
33

4-
import { IRoute, Link } from 'umi';
54
import { PageContainer } from '@ant-design/pro-layout';
6-
import { Affix, Button, Space } from 'antd';
7-
import { UpCircleOutlined } from '@ant-design/icons';
5+
import { BackTop, Space } from 'antd';
6+
import { IRoute, Link } from 'umi';
87

9-
import UserInfo from './component/UserInfo';
108
import AppQrcode from './component/AppQrcode';
9+
import UserInfo from './component/UserInfo';
1110

1211
const getCurrentRoute = (route: IRoute, path: string): IRoute | undefined => {
1312
let target;
@@ -95,22 +94,7 @@ const Layout: React.FC<React.PropsWithChildren<Props>> = (props) => {
9594
</ProCard>
9695
</ProCard>
9796

98-
<Affix
99-
offsetBottom={50}
100-
style={{
101-
position: 'fixed',
102-
right: '24px',
103-
}}
104-
>
105-
<Button
106-
onClick={() => {
107-
window.scrollTo(0, 0);
108-
}}
109-
>
110-
<UpCircleOutlined />
111-
回到顶部
112-
</Button>
113-
</Affix>
97+
<BackTop />
11498
</PageContainer>
11599
);
116100
};

0 commit comments

Comments
 (0)