我正在嘗試為我的 next.js 項目中的每個頁面設(shè)置自定義標(biāo)題。假設(shè)這是我的簡單布局const MainLayout = props => { return ( <Layout style={{ minHeight: "100vh" }}> <Head> <title>I AM TITLE</title> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta charSet="utf-8" /> </Head> <Layout> <Content>{props.children}</Content> <FooterView /> </Layout> </Layout> );};export default withTranslation('common')(MainLayout)和登錄頁面。import MainLayout from "../../components/layout/Layout";class NormalLoginForm extends React.Component { render() { const { getFieldDecorator } = this.props.form; return ( <MainLayout> // LOGIN FORM </MainLayout> ); }}const WrappedNormalLoginForm = Form.create({ name: "normal_login" })( NormalLoginForm);export default WrappedNormalLoginForm;我只是找不到如何將標(biāo)題從登錄頁面發(fā)送到像變量一樣的布局的方法(我仍然是新手)。感謝您的任何幫助。
Nextjs 向組件發(fā)送數(shù)據(jù)(頁面標(biāo)題)
藍山帝景
2022-01-01 21:09:37