- Read NuxtJS router documentation
Nuxt automatically creates routes out of all you
.vuefiles in thepages/directory. It usesNuxtLinksyntax for all the pages in this directory (local links). For external links, use the traditionala hrefsyntax.
<template>
<nav>
<ul>
<li><nuxt-link to="/">Home</nuxt-link></li>
</ul>
</template>
- This will call the
index.vueinpages/ - You can use either PascalCase:
NuxtLinkor kebab-casenuxt-link
To make the router ignore certain files in your pages/ directory, you simply have to place a - infront of the filename.
pages/
index.vue
-about.vue
- In this example, the index page would be visible to the router, but the about page would not be.
To style your nuxt-links active state with css, use the class .nuxt-link-active in your css. Note that you can do this right in your Navigation component