diff --git a/src/app/(home)/@header/_client/product.tsx b/src/app/(home)/@header/_client/product.tsx index 729ac47..6998412 100644 --- a/src/app/(home)/@header/_client/product.tsx +++ b/src/app/(home)/@header/_client/product.tsx @@ -1,4 +1,5 @@ -import {ReactNode, useContext, useState} from 'react' +'use client' +import {ReactNode, useContext, useState, useEffect} from 'react' import Wrap from '@/components/wrap' import Image from 'next/image' import anno from '@/assets/header/product/anno.svg' @@ -7,6 +8,7 @@ import {merge} from '@/lib/utils' import prod from '@/assets/header/product/prod.svg' import custom from '@/assets/header/product/custom.svg' import {HeaderContext} from '@/app/(home)/@header/_client/provider' +import {useSearchParams} from 'next/navigation' type TabType = 'domestic' | 'oversea' @@ -15,6 +17,8 @@ export function Tab(props: { onSelect: () => void children: ReactNode }) { + const searchParams = useSearchParams() + const currentType = searchParams?.get('type') || 'short' return (
  • diff --git a/src/components/composites/purchase/index.tsx b/src/components/composites/purchase/index.tsx index dc89b25..1998242 100644 --- a/src/components/composites/purchase/index.tsx +++ b/src/components/composites/purchase/index.tsx @@ -1,29 +1,36 @@ +'use client' import {ReactNode} from 'react' import {merge} from '@/lib/utils' import {Tabs, TabsContent, TabsList, TabsTrigger} from '@/components/ui/tabs' import LongForm from '@/components/composites/purchase/long/form' import ShortForm from '@/components/composites/purchase/short/form' +import Link from 'next/link' +import {useSearchParams} from 'next/navigation' -export type PurchaseProps = {} +export type TabType = 'short' | 'long' | 'fixed' | 'custom' -export default async function Purchase(props: PurchaseProps) { +export default function Purchase() { + const searchParams = useSearchParams() + const defaultTab = searchParams?.get('type') as TabType || 'short' return ( -
    - - - 短效动态 - 长效静态 - 固定套餐 - 定制套餐 - - - - - - - - -
    + <> +
    + + + 短效动态 + 长效静态 + 固定套餐 + 定制套餐 + + + + + + + + +
    + ) } @@ -32,13 +39,22 @@ function Tab(props: { children: ReactNode }) { return ( - - {props.children} - + + + {props.children} + + ) }