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.
Learn more in the Directory Structure book in the middleware chapter.
Loading Sandbox...
Editer cette page sur GitHub
Mise à jour le Mon, July 12, 2021