Fail to integrate with Nuxt3 #2137
-
Reproductionhttps://stackblitz.com/edit/nuxt-starter-mjjyny?file=app.vue Steps to reproduce the bug
Expected behaviorShould see the web render succeed. Actual behavior
Additional information |
Beta Was this translation helpful? Give feedback.
Answered by
posva
Apr 12, 2023
Replies: 1 comment 3 replies
-
You need to put the import { useBStore } from './b';
// cannot call useBStore() here
export const useAStore = defineStore('a', {
state: () => {
return {
a: 22,
};
},
actions: {
increaseA() {
this.a++;
// it must be here
const bStore = useBStore();
bStore.decrease();
},
},
}); |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
posva
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need to put the
useStore()
within the other store, not outside: