How can I access global properties in vuex actions?
Hi,
I bought your Metronic 8 theme.
I am using VUE verison. How Can I access this globalProperties in store modules @actions.
you can see what property I want to access : https://i.imgur.com/FfvPRVE.jpg
Thank you.
Berat
Replies (3)
Hi,
You can get store instances using useStore function imported from vuex.
import { useStore } from "vuex";
import { useRoute, useRouter } from "vue-router";
const store = useStore();
const route = useRoute();
const router = useRouter();
You can check examples in file src/layout/Layout.vue.
i want to access app instance not router or store. this is not answer you didnt understand my question
If you want to get these global properties through an app instance, you can just follow an object structure:
console.log(app.config.globalProperties.$store);
You can read more about globalProperties in the official Vue doc:
https://v3.vuejs.org/guide/migration/global-api.html#vue-prototype-replaced-by-config-globalproperties