升级依赖版本并修复构建问题
This commit is contained in:
@@ -55,7 +55,7 @@ export function Tab(props: {
|
||||
<button
|
||||
className={[
|
||||
`w-full p-4 lg:p-6 text-base lg:text-lg cursor-pointer border-b lg:border-b-0 lg:border-r flex justify-center`,
|
||||
props.selected ? `bg-gradient-to-b lg:bg-gradient-to-r from-transparent to-blue-200 border-blue-400` : `border-gray-200`,
|
||||
props.selected ? `bg-linear-to-b lg:bg-linear-to-r from-transparent to-blue-200 border-blue-400` : `border-gray-200`,
|
||||
].join(' ')}
|
||||
onClick={props.onSelect}
|
||||
>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
'use client'
|
||||
import {useCallback, useEffect, useMemo, useState, PointerEvent, ComponentProps} from 'react'
|
||||
import {useCallback, useEffect, useMemo, useState, PointerEvent, ComponentProps, useSyncExternalStore} from 'react'
|
||||
import Link from 'next/link'
|
||||
import Image from 'next/image'
|
||||
import {HeaderContext} from './_components/header/common'
|
||||
@@ -15,7 +15,6 @@ import UserCenter from '@/components/composites/user-center'
|
||||
import {MenuIcon} from 'lucide-react'
|
||||
import down from '@/assets/header/down.svg'
|
||||
import {merge} from '@/lib/utils'
|
||||
import {User} from '@/lib/models'
|
||||
|
||||
export type HeaderProps = {}
|
||||
|
||||
@@ -24,20 +23,12 @@ export default function Header(props: HeaderProps) {
|
||||
// 滚动条状态
|
||||
// ======================
|
||||
|
||||
const [scroll, setScroll] = useState(false) // Changed to false for client-side rendering
|
||||
|
||||
const handleScroll = useCallback(() => {
|
||||
setScroll(window.scrollY > 48)
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
// Initialize scroll state on client
|
||||
setScroll(window.scrollY > 48)
|
||||
window.addEventListener('scroll', handleScroll)
|
||||
const scroll = useSyncExternalStore((callback) => {
|
||||
window.addEventListener('scroll', callback)
|
||||
return () => {
|
||||
window.removeEventListener('scroll', handleScroll)
|
||||
window.removeEventListener('scroll', callback)
|
||||
}
|
||||
}, [handleScroll])
|
||||
}, () => window.scrollY > 48, () => false)
|
||||
|
||||
// ======================
|
||||
// 菜单状态
|
||||
|
||||
@@ -3,19 +3,19 @@ import Wrap from '@/components/wrap'
|
||||
import Purchase, {TabType} from '@/components/composites/purchase'
|
||||
|
||||
export type ProductPageProps = {
|
||||
searchParams?: {
|
||||
searchParams?: Promise<{
|
||||
type?: TabType
|
||||
}
|
||||
}>
|
||||
}
|
||||
|
||||
export default function ProductPage(props: ProductPageProps) {
|
||||
export default async function ProductPage(props: ProductPageProps) {
|
||||
return (
|
||||
<main className="mt-20">
|
||||
<Wrap className="flex flex-col py-8 gap-4">
|
||||
<BreadCrumb items={[
|
||||
{label: '产品中心', href: '/product'},
|
||||
]}/>
|
||||
<Purchase defaultType={props.searchParams?.type ?? 'short'}/>
|
||||
<Purchase defaultTab={(await props.searchParams)?.type ?? 'short'}/>
|
||||
</Wrap>
|
||||
</main>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user