Accessing $vuetify Instance Property From Vuex Store
Answer :
For Vuetify 2.0 you can try following method. (After following Vuetify 2.0 Upgrade guide for themes)
import Vuetify from './plugins/vuetify' export default { getters: {}, mutations: { toggleDarkTheme(state) { Vuetify.framework.theme.themes.light.primary = "#424242"; } }
$vuetify is an instance property hence you can access any vue instance property using
Vue.prototype.$prop
For your case
import Vue from 'vue'; export default { getters: {}, mutations: { toggleDarkTheme(state) { Vue.prototype.$vuetify.theme.primary = "#424242"; } } };
For Nuxt.js projects with Vuetify set as a buildModule
, you can access $vuetify
from the $nuxt
property in the Vue instance:
import Vue from 'vue'; export actions = { yourAction() { Vue.prototype.$nuxt.$vuetify.theme.dark = true; } }
Comments
Post a Comment