路由中间件
通过使用路由中间件为 body 设置 class,实现根据路由显示不同样式的效果
在这个示例中:
store/class.js 为 body 设置 class。
middleware/class.js 使用路由中间件,在进入路由之前设置 class。
components/Navigation.vue 更改名为 router-middleware 的路由的字体大小。
nuxt.config.js 包含用于启动中间件的 router 属性。
更多详情,请查看目录结构中的中间件目录 章节。
Loading Sandbox...
Edit this page on GitHub
Updated at Tue, Apr 14, 2026