nuxt
nuxt copied to clipboard
Access vuetify instance from plugin
How can I access $vuetify
from plugin? I use i18n plugin and I want to change vuetify locale when i18n's one changed:
export default function({ app }) {
app.i18n.onLanguageSwitched = (oldLocale, newLocale) => {
WHAT.$vuetify.lang.current = newLocale
}
}
Not sure if this is the correct way but you can inject vuetify into context like this:
export default function(_, inject) {
Vue.use(Vuetify { ...options });
inject('vuetify', Vue.prototype.$vuetify);
};
Then use it in a plugin like:
export default function({ app }) {
app.$vuetify.lang.current = fooBar;
}