使用 nuxt-link 相对于 router-link 有什么优势?

What is the advantage of using nuxt-link over router-link?

Nuxt中,我们既可以使用router-link,也可以使用nuxt-link。使用 nuxt-linkrouter-link 有什么优势?

<nuxt-link to="/about">About</nuxt-link>

而不是

<router-link to="/about">About</router-link>

根据Nuxt Docs,有两个要点:

This component (<nuxt-link>) is used to provide navigations between page components and enhance performances with smart prefetching.

In fact, <nuxt-link> extends <router-link>. That means it takes the same properties and can be used in the same manner.

之后我们可以阅读 smart prefetching:

Nuxt.js will automagically prefetch the code-splitted pages linked with when visible in the viewport by default. This hugely improves the end user performances.

基于此,我认为您只是希望使用 <nuxt-link> 获得更好的性能。