0
votes

I'm having a situation where I use a specific Vue component in multiple ways. Sometimes I initialize it as an SPA with new Vue({store}) and sometimes I use it from within another vue component.

E.g.

<template>
  <component/>
</template>

How would I go about attaching a vuex store to the component in the above situation? Manually overriding the $store property obviously does not work and the Vue instance itself doesn't really shed any light on the matter. Is there a way to achieve this?

I've written a simple store factory which creates a new instance of the vuex store but I need a way to attach this to a component from within a vue template/comp.

Said component is complex enough to warrant vuex.

1

1 Answers

0
votes

Apparently setting the $store property manually does do the trick.

this.$store = store