由 CyanHall.com
创建于 2020-11-21,
上次更新:2021-01-08。
👉
如果有用请点赞。
👉
1. Installation
$ npm i -g @nestjs/cli
$ nest new project-name
2. Lifecycle events
onModuleInit()
onApplicationBootstrap()
onModuleDestroy()
beforeApplicationShutdown()
onApplicationShutdown()
3. next.config.js
const path = require('path');
module.exports = {
webpack (config) {
// Module import alias
config.resolve.alias['~'] = path.resolve(__dirname, `.`);
return config;
}
}
import Layout from "~/components/layout"
4. Link with className
<Link href="/">
<a className="foo" target="_blank" rel="noopener noreferrer">
Hello World
</a>
</Link>
5. Render HTML
<div dangerouslySetInnerHTML={{ __html: postData.contentHtml }} />
-
To use
CSS Modules
, import a CSS file named*.module.css
from any component. -
To use global CSS, import a CSS file in
pages/_app.js
. getStaticProps
andgetStaticPaths
runs only on the server-side.
更多