Router Middleware

Using router middleware to set a class to the body so we can then style differently depending on the route


In this example:

store/class.js sets a class to the body.

middleware/class.js uses router middleware to set a class before we enter the route.

components/Navigation.vue changes the font size for the route with the name of router-middleware.

nuxt.config.js contains the router property to activate the middleware.

Loading Sandbox...
Edit this page on GitHub Updated at Thu, Sep 23, 2021