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...
Edit this page on GitHub
Updated at Wed, Apr 3, 2024
Sébastien Chopin
川音리오
Maciek Palmowski
Nestor Vera
Daniel Roe
Yue Yang
Jeronimas
Clément Ollivier
Alexander Lichter
N3-rd
Adrien Zaganelli
Mag
Stefan Huber
Olga Bulat
Paiva
Florian Reuschel
Rishi Raj Jain
Savas Vedova
Steven Soekha
Vinícius Alves
Kareem Dabbeet
Valentín Costa
Ryan Skinner
Alex Hirzel
Ajeet Chaulagain
René Eschke
Nico Devs
Muhammad Bin Shehzad
Nazaré da Piedade
Naoki Hamada
Tom
Yann Aufray
Anthony Chu
Nuzhat Minhaz
Lucas Portet
Richard Schloss
Bobby
bpy
Antony Konstantinidis
Hibariya
Jose Seabra
Eze
Florian Lefebvre
Lucas Recoaro
Julien SEIXAS
Sylvain Marroufin
Spencer Cooley
Piotr Zatorski
Vladimir Semyonov
Harry Allen
kazuya kawaguchi