Skip to content

Commit efda05b

Browse files
committed
perf: header
1 parent b231346 commit efda05b

File tree

2 files changed

+1
-27
lines changed

2 files changed

+1
-27
lines changed

src/components/layout/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ const Header = ({ hiddenAd, showAd }: Props) => {
104104
{t('header.periodical')}
105105
</HeaderBtn>
106106
</li>
107-
<li className={liClassName('/report/tiobe')}>
107+
<li className={liClassName('/report')}>
108108
<RankButton t={t} />
109109
</li>
110110
<li className={liClassName('/article')}>

src/pages/_app.tsx

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ import { AppProps } from 'next/app';
22
import { useRouter } from 'next/router';
33
import Script from 'next/script';
44
import { appWithTranslation } from 'next-i18next';
5-
import NProgress from 'nprogress';
6-
import { useEffect } from 'react';
75

8-
import 'nprogress/nprogress.css';
96
import '@/styles/globals.css';
107

118
import { LoginProvider } from '@/hooks/useLoginContext';
@@ -27,29 +24,6 @@ function MyApp({ Component, pageProps }: AppProps) {
2724
// 需要单页面展示的路由
2825
const singlePage: string[] = ['/404', '/500'];
2926

30-
// 页面跳转时的加载进度条
31-
useEffect(() => {
32-
// 不显示右上角的加载转圈图标
33-
NProgress.configure({ showSpinner: false });
34-
const handleStart = () => {
35-
NProgress.start();
36-
};
37-
38-
const handleStop = () => {
39-
NProgress.done();
40-
};
41-
42-
router.events.on('routeChangeStart', handleStart);
43-
router.events.on('routeChangeComplete', handleStop);
44-
router.events.on('routeChangeError', handleStop);
45-
46-
return () => {
47-
router.events.off('routeChangeStart', handleStart);
48-
router.events.off('routeChangeComplete', handleStop);
49-
router.events.off('routeChangeError', handleStop);
50-
};
51-
}, [router]);
52-
5327
return (
5428
<div id='root'>
5529
<Script id='baidu-analytics'>

0 commit comments

Comments
 (0)