Nuxt/examples/routes-meta/middleware/theme.js
Илья 90db0aded8 Update theme.js (#4068)
More clear option
2018-10-10 16:09:21 +01:00

6 lines
203 B
JavaScript

export default ({ route, store }) => {
// Take the last value (latest route child)
const theme = route.meta.reduce((theme, meta) => meta.theme || theme, 'light')
store.commit('SET_THEME', theme)
}