当前位置 博文首页 > Next.js:仅在Next.js的服务器端或客户端运行代码_cuk0051的博客
next. js
In your page components, you can execute code only in the server-side or on the client-side, but checking the window
property.
在页面组件中,您只能在服务器端或客户端执行代码,但可以检查window
属性。
This property is only existing inside the browser, so you can check
此属性仅存在于浏览器内部,因此您可以检查
if (typeof window === 'undefined') {
}
cs