Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nuxt有哪些特性?为什么要用nuxt做服务端渲染?它解决了什么问题? #49

Open
artdong opened this issue Nov 11, 2019 · 1 comment
Labels
ssr ssr

Comments

@artdong
Copy link
Collaborator

artdong commented Nov 11, 2019

nuxt有哪些特性?为什么要用nuxt做服务端渲染?它解决了什么问题?

@artdong artdong added the ssr ssr label Nov 11, 2019
@artdong
Copy link
Collaborator Author

artdong commented Nov 18, 2019

nuxt特性

  • 基于 Vue.js
  • 自动代码分层
  • 服务端渲染
  • 强大的路由功能,支持异步数据
  • 静态文件服务
  • ES2015+ 语法支持
  • 打包和压缩 JS 和 CSS
  • HTML 头部标签管理
  • 本地开发支持热加载
  • 集成 ESLint
  • 支持各种样式预处理器: SASS、LESS、 Stylus 等等
  • 支持 HTTP/2 推送

Nuxt.js 渲染流程

应用一个完整的服务器请求到渲染(或用户通过 切换路由渲染页面)的流程

服务端渲染解决的痛点

SPA前端渲染存在两大痛点:

(1)SEO。搜索引擎爬虫难以抓取客户端渲染的页面meta信息和其他SEO相关信息,使网站无法在搜索引擎中被用户搜索到。

(2)用户体验。大型webApp打包之后的js会很庞大,于是就有了按模块加载,像require.js一样,异步请求。webpack盛行,就变成了代码分割。即便如此,受制于用户设备,页面初次渲染还是有可能很慢,白屏等待时间太长,对日益挑剔的用户群体来说,无法接受。

服务端渲染解决了前端渲染的两大痛点:SEO、首屏加载速度慢。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ssr ssr
Projects
None yet
Development

No branches or pull requests

1 participant