要改善我的Web应用程序的SEO,我希望主页由nuxt之类的服务器呈现,但是登录后,我需要常规的动态Vue应用程序。
答案 0 :(得分:0)
在nuxt中,您可以使用serverMiddleware来做到这一点。
export default function(req, res, next) {
const paths = ['/', '/a']
if (paths.includes(req.originalUrl)) {
// Will trigger the "traditional SPA mode"
res.spa = true
}
// Don't forget to call next in all cases!
// Otherwise, your app will be stuck forever :|
next()
}
https://blog.lichter.io/posts/selectively-enable-ssr-or-spa-mode-in-a-nuxtjs-ap