Replace veux $store with $pinia #1958
-
When using vuex we have $store object that is accessible in every component |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You already have this.$pinia.state.value If you want access to the stores, you will need to collect them in a plugin and add them to global properties: const stores = {}
pinia.use(({ store }) => {
stores[store.$id] = store
})
app.config.globalProperties.$stores = stores But I recommend you to avoid this because it cannot be made type safe and stays in an "vuex way of thinking" instead of embracing the new defaults that enable better code splitting and dynamic registration by default |
Beta Was this translation helpful? Give feedback.
You already have
$pinia
available, which gives you access to all instantiated stores' state:If you want access to the stores, you will need to collect them in a plugin and add them to global properties:
But I recommend you to avoid this because it cannot be made type safe and stays in an "vuex way of thinking" instead of embracing the new defaults that enable better code splitting and dynamic registration by default