Skip to content

Turbolinks 加速导航 #203

@LiuuY

Description

@LiuuY

现在顶部导航点击之后有点点缓慢,某种程度是因为点击之后 Angular Router 加载新的组件(包括 Lazy Import),但是由于网站已经使用了 SSG 来渲染了所有的导航页面,这就导致 Angular Router 重新加载的意义不大。

所以使用 <a> 标签直接跳转例如: <a href="/manual" />,但是这又导致重洗加载所有的库。

这里尝试使用 Turbolinks,来加载 <a>标签跳转的内容。

还有若干问题要解决,如:

  1. 虽然不需要重新加载库,但是 Angular 要重新 bootstrapModule,这也导致在 bootstrapModule 之前无法交互(由于 Angular 没有初始化),这反而又降低了速度😅。
  2. 导航选中颜色(似乎很简单解决)。
  3. development 时效果不好(由于没有 SSG)。

demo 在分支 turbolink-poc,需要 build SSG 后启动看效果。

yarn build; yarn scully;

归根结底好像没什么用🤦

Metadata

Metadata

Assignees

Labels

RFCRequest for Comments

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions