简体   繁体   English

将现有的 vuejs 应用程序转换为使用 nuxt SSR 有多难?

[英]How difficult is to convert an existing vuejs app to use nuxt SSR?

I built a news website using vuejs and for SEO and performance reasons i would like to utilize SSR(Server side rendering) using nuxt, I could find many resources in writing a new nuxt app but nothing on converting an existing vuejs app to nuxt.我使用 vuejs 建立了一个新闻网站,出于 SEO 和性能原因,我想使用 nuxt 来利用 SSR(服务器端渲染),我可以找到很多资源来编写新的 nuxt 应用程序,但在将现有的 vuejs 应用程序转换为 nuxt 时却一无所获。 Has anyone tried this or have recommendations on how to do it?有没有人尝试过这个或有关于如何做的建议?

I suggest you that you need to create new project as parallel.我建议您需要以并行方式创建新项目。 And convert Vue projects to Nuxt.js project step by step.并逐步将Vue项目转换为Nuxt.js项目。

Please watch Why Use Nuxt.js?请观看Why Use Nuxt.js? video on https://nuxtjs.org/ home page. https://nuxtjs.org/主页上的视频。

Pretty straight forward.很直接。 Since Nuxt used Vue, all of your components would work the same.由于 Nuxt 使用了 Vue,因此您的所有组件都可以正常工作。

I would create a new blank Nuxt app, then manually migrate each of the pages and components into the new Nuxt app.我会创建一个新的空白 Nuxt 应用程序,然后手动将每个页面和组件迁移到新的 Nuxt 应用程序中。

Then with Nuxt, you can choose:然后使用 Nuxt,您可以选择:

  1. if you want to use server side rendering (SSR): npm run build如果你想使用服务器端渲染(SSR): npm run build
  2. or statically generate your site: npm run generate或静态生成您的站点: npm run generate

EDIT: You can also supercharge your nuxt site with the nuxt seo package .编辑:您还可以使用nuxt seo package为您的 nuxt 站点增压。

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

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