三工区曹到儿 發表於 2022-5-24 17:21:00

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

<p>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;</p>
<p>Because Document only render on Server side, so it doesn't support event such as onClick....</p>
<p>pages/_document.txs</p>
<pre class="language-javascript"><code>import { Html, Head, Main, NextScript } from "next/document";

export default function Document() {
return (
    &lt;Html lang="en"&gt;
      &lt;Head&gt;
          &lt;link rel="icon" href="data:image/svg+xml,&lt;svg xmlns=%22http://www.w3.org/2000/svg%22" /&gt;
      &lt;/Head&gt;
      &lt;body&gt;
      &lt;Main /&gt;
      &lt;NextScript /&gt;
      &lt;/body&gt;
    &lt;/Html&gt;
)
}</code></pre>
<p>&nbsp;</p><br><br>
来源:https://www.cnblogs.com/Answer1215/p/16306320.html
頁: [1]
查看完整版本: [Next.js] Override the Default Next.js Document