查看: 103|回覆: 0

[Next.js] Override the Default Next.js Document

[複製鏈接]

2

主題

0

回帖

0

積分

热心网友

金币
0
閲讀權限
220
精華
0
威望
0
贡献
0
在線時間
0 小時
註冊時間
2010-2-19
發表於 2022-5-24 17:21:00 | 顯示全部樓層 |閲讀模式

The Document is like the top level HTML structure of your Next.js application. You can use document to change the default language, set favicon;

Because Document only render on Server side, so it doesn't support event such as onClick....

pages/_document.txs

import { Html, Head, Main, NextScript } from "next/document";

export default function Document() {
  return (
    <Html lang="en">
      <Head>
          <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22" />
      </Head>
      <body>
        <Main />
        <NextScript />
      </body>
    </Html>
  )
}

 



来源:https://www.cnblogs.com/Answer1215/p/16306320.html
回覆

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 立即注册

本版積分規則

相关侵权、举报、投诉及建议等,请发 E-mail:qiongdian@foxmail.com

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部