[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 (
<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>
)
}</code></pre>
<p> </p><br><br>
来源:https://www.cnblogs.com/Answer1215/p/16306320.html
頁:
[1]