How to import a store from a variable #1203
Unanswered
appliweb-ar
asked this question in
Help and Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi Devs!
In Vue3 and Vuex, I have 20 modules:
Menu01.js
Menu02.js
Menu03.js
etc
And I have a variable with the value of the module I need to use: Menu = 'Menu05'.
<script>
import { useStore } from 'vuex'
export default {
setup () {
const MenuChosen = store.state[Menu]
}
</script>
This makes me assign to the variable 'MenuChosen' only the module I need.
Is there any way to do something similar in Pinia?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions