简体   繁体   English

检测 Nuxt.js 中的服务器端渲染

[英]Detecting Server Side Rendering in Nuxt.js

I have a Nuxt.js app that uses Server Side Rendering.我有一个使用服务器端渲染的 Nuxt.js 应用程序。 However in one of my pages I need to detect if it's SSR for a toggle of one of the components.但是,在我的一个页面中,我需要检测它是否是用于切换其中一个组件的 SSR。 What are some possible ways of creating an isSSR flag?创建isSSR标志的一些可能方法是什么?

Use just只用

process.server

Vue exposes two attributes on process global variable. Vue 在进程全局变量上公开了两个属性。 server and client and one of them is set true according to rendering side. serverclient ,其中一个根据渲染端设置为真。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM