Within a component, I am receiving an array called approvalOptions from getters that contains a certain value I need to find.
I have attempted the following methods:
- Using it within methods (read from ...mapGetters) as shown below
methods: {
approvalDisplayName(value) {
console.log(this.approvalOptions)
return this.approvalOptions.find(it => it.key === value).displayName;
},
},
- Utilizing it in computed properties instead of methods (with code sample similar to above)
- Implementing it within methods and reading from data properties as demonstrated below
data() {
return {
approvalOptions: [...(objects with keys and values here)]
}
},
methods: {
approvalDisplayName(value) {
console.log(this.approvalOptions)
return this.approvalOptions.find(it => it.key === value).displayName;
},
},
Despite attempting all three methods, I consistently encounter an error message in the console indicating that approvalOptions.find(...) does not exist. The console.log output also displays the array, leaving me confused about what exactly is happening.