fix: await params promise in Next.js 16

This commit is contained in:
张翔
2026-02-26 18:38:00 +08:00
parent 1c5ec4d663
commit 87719f318f
3 changed files with 21 additions and 17 deletions
+6 -4
View File
@@ -11,8 +11,9 @@ export async function generateStaticParams() {
}));
}
export async function generateMetadata({ params }: { params: { slug: string } }) {
const news = NEWS.find((n) => n.id === params.slug);
export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }) {
const { slug } = await params;
const news = NEWS.find((n) => n.id === slug);
if (!news) {
return {
@@ -26,8 +27,9 @@ export async function generateMetadata({ params }: { params: { slug: string } })
};
}
export default function NewsDetailPage({ params }: { params: { slug: string } }) {
const news = NEWS.find((n) => n.id === params.slug);
export default async function NewsDetailPage({ params }: { params: Promise<{ slug: string }> }) {
const { slug } = await params;
const news = NEWS.find((n) => n.id === slug);
if (!news) {
notFound();
+6 -4
View File
@@ -10,8 +10,9 @@ export async function generateStaticParams() {
}));
}
export async function generateMetadata({ params }: { params: { id: string } }) {
const product = PRODUCTS.find((p) => p.id === params.id);
export async function generateMetadata({ params }: { params: Promise<{ id: string }> }) {
const { id } = await params;
const product = PRODUCTS.find((p) => p.id === id);
if (!product) {
return {
@@ -25,8 +26,9 @@ export async function generateMetadata({ params }: { params: { id: string } }) {
};
}
export default function ProductDetailPage({ params }: { params: { id: string } }) {
const product = PRODUCTS.find((p) => p.id === params.id);
export default async function ProductDetailPage({ params }: { params: Promise<{ id: string }> }) {
const { id } = await params;
const product = PRODUCTS.find((p) => p.id === id);
if (!product) {
notFound();
+9 -9
View File
@@ -10,23 +10,23 @@ import { COMPANY_INFO, STATS } from '@/lib/constants';
const values = [
{
icon: Lightbulb,
title: '创新驱动',
description: '持续探索前沿技术,以创新思维解决业务挑战,为客户创造差异化价值',
title: '智连未来',
description: '坚持对行业趋势的深度研究,不追逐昙花一现的概念,让技术真正服务于您的未来',
},
{
icon: Users,
title: '客户至上',
description: '深入理解客户需求,提供个性化解决方案,建立长期合作伙伴关系',
title: '成长伙伴',
description: '不把项目交付当作终点,以客户业务增长和团队能力提升为最终目标',
},
{
icon: Target,
title: '追求卓越',
description: '精益求精的工作态度,确保每个项目都达到最高质量标准',
title: '务实担当',
description: '只提供真正需要的技术方案,不卖用不上的技术,不说不懂业务的术语',
},
{
icon: Award,
title: '诚信负责',
description: '恪守商业道德,对承诺负责,赢得客户和社会的信任与尊重',
title: '长期陪伴',
description: '不是一锤子买卖,而是成为您数字化转型路上值得信赖的长期伙伴',
},
];
@@ -54,7 +54,7 @@ export function AboutSection() {
>
<div className="text-center mb-16">
<h2 className="text-4xl md:text-5xl font-bold text-[#1C1C1C] mb-6">
"伙伴"
<span className="tracking-tight font-calligraphy text-[#C41E3A]" style={{ fontWeight: 'normal', WebkitFontSmoothing: 'antialiased', MozOsxFontSmoothing: 'grayscale', textRendering: 'optimizeLegibility' }}>{COMPANY_INFO.shortName}</span>
</h2>
<p className="text-lg text-[#5C5C5C]">
{COMPANY_INFO.slogan}