1👍
✅
Or you could simplify the computed property definition using parenthesis, so you will keep the application’s context:
borrowingHistroy() {
return userData[this.userId].borrowingHistory
}
2👍
You should pass the component instance as arrow function parameter :
borrowingHistroy: (vm) => userData[vm.userId].borrowingHistory,
According to the official docs :
Note that if you use an arrow function with a computed property, this won’t be the component’s instance, but you can still access the instance as the function’s first argument:
computed: {
aDouble: vm => vm.a * 2
}
Source:stackexchange.com