If you want to force a computed property to update and recalculate it’s value, you can simply use a data property and just mention that property in the computed function (you don’t have to use it, just being there is enough), and then change that data property; This will force the computed value to update.
Here is the code:
data() {
return {
refreshKey: 0,
// ...
}
},
computed: {
myComputedValue() {
// just mentioning refreshKey
this.refreshKey;
// rest of the function that actualy do the calculations and returns a value
},
},
methods: {
myMethod() {
// the next line would force myComputedValue to update
this.refreshKey++;
// the rest of my method
},
},