在Next.js 13的app目录中,我在官方文档中看到他们已经放弃了旧的head方法而转而使用元数据,我认为它只能在页面或布局上使用。
我想根据状态值更改标题,我该怎么做? 元数据中的对象位于组件外部,因此我无法引用它。
import type { Metadata } from 'next';
export const metadata: Metadata = {
title: 'Home',
description: 'Welcome to Next.js',
};
export default function Page() {
return '...';
}
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号