优化预加载策略
This commit is contained in:
+3
-3
@@ -896,7 +896,7 @@ function HomeClient() {
|
||||
</button>
|
||||
|
||||
{musicEnabled && (
|
||||
<Link href='/music'>
|
||||
<Link href='/music' prefetch={false}>
|
||||
<button
|
||||
className='p-1.5 rounded-lg text-green-500 hover:text-green-600 transition-colors'
|
||||
title='音乐视听'
|
||||
@@ -907,7 +907,7 @@ function HomeClient() {
|
||||
)}
|
||||
|
||||
{mangaEnabled && (
|
||||
<Link href='/manga'>
|
||||
<Link href='/manga' prefetch={false}>
|
||||
<button
|
||||
className='p-1.5 rounded-lg text-emerald-500 hover:text-emerald-600 transition-colors'
|
||||
title='漫画展馆'
|
||||
@@ -918,7 +918,7 @@ function HomeClient() {
|
||||
)}
|
||||
|
||||
{booksEnabled && (
|
||||
<Link href='/books'>
|
||||
<Link href='/books' prefetch={false}>
|
||||
<button
|
||||
className='p-1.5 rounded-lg text-amber-500 hover:text-amber-600 transition-colors'
|
||||
title='电子书馆'
|
||||
|
||||
@@ -21,7 +21,6 @@ const MobileHeader = ({ showBackButton = false }: MobileHeaderProps) => {
|
||||
<div className='flex items-center gap-2'>
|
||||
<Link
|
||||
href='/search'
|
||||
prefetch={false}
|
||||
className='w-10 h-10 p-2 rounded-full flex items-center justify-center text-gray-600 hover:bg-gray-200/50 dark:text-gray-300 dark:hover:bg-gray-700/50 transition-colors'
|
||||
>
|
||||
<svg
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
import { BackButton } from './BackButton';
|
||||
@@ -18,9 +19,15 @@ interface PageLayoutProps {
|
||||
}
|
||||
|
||||
const PageLayout = ({ children, activePath = '/', hideNavigation = false }: PageLayoutProps) => {
|
||||
const router = useRouter();
|
||||
const [backgroundImage, setBackgroundImage] = useState('');
|
||||
const shouldShowSharedBackground = !hideNavigation && activePath !== '/play';
|
||||
|
||||
useEffect(() => {
|
||||
router.prefetch('/search');
|
||||
router.prefetch('/play');
|
||||
}, [router]);
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof window === 'undefined' || !shouldShowSharedBackground) {
|
||||
setBackgroundImage('');
|
||||
|
||||
Reference in New Issue
Block a user