I’m trying to updated a Computed Property. The data is coming from vuex state.
I get my data from the store. I want to updated the value allowed in the store. However when I click my update button it dosn’t update the value.
html
<div @click="update">update</div>
<b-row>
<b-col v-for="cat in categories" :key="cat.id" sm="12" md="6" lg="4">
<div>{{cat.allowed}}</div>
</b-col>
</b-row>
computed: {
...mapGetters("categories", ["customerCategories"]),
categories() {
return this.customerCategories;
},
methods: {
update() {
this.categories.filter((element) => (element.allowed = true));
console.log(this.categories); // not updating the allowed
},
}
},
// from the store
categories = [
{
allowed: false
description: "hsdkj fskdjf skfj"
id: 15
},
{
allowed: false
description: "blah blah"
id: 13
},
{
allowed: false
description: "more blah blah"
id: 13
},
{
allowed: false
description: "lots more blah blah"
id: 1
}
]