I have a vue2 app with a pinia store. When a vue component loads it reads a json object. I want this to be fed into an array in pinia. When trying (in options API)
<code>mounted: {
Object.keys(this.myjson).map(function (v) {
this.filters[v] = [];
});
},
// after having
computed: {
...mapWritableState(useSearchStore, ["filters"]),
},
</code>
<code>mounted: {
Object.keys(this.myjson).map(function (v) {
this.filters[v] = [];
});
},
// after having
computed: {
...mapWritableState(useSearchStore, ["filters"]),
},
</code>
mounted: {
Object.keys(this.myjson).map(function (v) {
this.filters[v] = [];
});
},
// after having
computed: {
...mapWritableState(useSearchStore, ["filters"]),
},
I get an error [Vue warn]: Slot "default" invoked outside of the render function
and the array in pinia stay empty.
What is the correct way to populate data in pinia from a component at mount?