_app.tsx 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. import type { AppProps } from 'next/app';
  2. import Head from 'next/head';
  3. import { useRouter } from 'next/router';
  4. import '@/styles/globals.css';
  5. import '@/styles/blue-theme.css';
  6. import { GoogleAnalytics } from '@next/third-parties/google';
  7. // 如果需要统计,请取消注释并安装 @vercel/analytics
  8. // import { Analytics } from "@vercel/analytics/next";
  9. export default function App({ Component, pageProps }: AppProps) {
  10. const router = useRouter();
  11. const isDetailsPage = router.pathname === '/details';
  12. return (
  13. <>
  14. <Head>
  15. <title>✨ 魔法少女生成器 ✨</title>
  16. <meta name="description" content="为你生成独特的魔法少女角色" />
  17. <meta name="viewport" content="width=device-width, initial-scale=1" />
  18. <link rel="icon" href="/favicon.svg" />
  19. </Head>
  20. <div className={isDetailsPage ? 'blue-theme' : ''}>
  21. <Component {...pageProps} />
  22. <GoogleAnalytics gaId={process.env.NEXT_PUBLIC_GA_ID || ''} />
  23. {/* <Analytics /> */}
  24. </div>
  25. </>
  26. );
  27. }