This is the first time I'm using VueJs, so this might be a very basic thing, but in one of my callbacks I try to set a new value to a value, saved in the "data" component.
But whenever I try to run this method, Vue says my "this" is undefined, so I can't set this new value.
export default {
name: 'app',
data() {
return {
collection : {},
}
},
mounted: function(){
var event = contract.statuschangedEvent(function(error, result) {
if (!error){
this.collection[result.args.id].status = result.args.status
}
});
...
The "contract" object is a web3 object, and the syntax should be fine according to this documentation
The error I'm getting is "Uncaught TypeError: Cannot read property '[object Object]' of undefined"