// @/components/ProductTabsClient.tsx (客户端组件) 'use client'; import { useTranslations } from 'next-intl'; import { useState } from 'react'; type ProductTabsClientProps = { detail: string; spec: string[]; packaging: string; locale: string; models: string[]; }; // 纯客户端交互组件(仅处理标签页切换) export default function ProductTabsClient({ detail, models, spec, packaging, locale }: ProductTabsClientProps) { const [activeTab, setActiveTab] = useState('spec'); // 仅客户端使用状态 const t = useTranslations("Product"); return (
{/* 标签栏 */}
{/* 内容区 */}
{activeTab === 'detail' &&
{models.map((item, idx) =>
{item}
) || t('productNoDetail')}
} {activeTab === 'spec' && ( spec.length > 0 ? (
{spec.map((item, idx) =>
{item}
)}
) : (

{t('productNoSpec')}

) )} {activeTab === 'packaging' &&
{packaging || t('productNoPacking')}
}
); }