I use simply computed to get correct values from my array to select field:
computed: {
specialitySelect() {
return this.$store.state.physicianListSpeciality
}
}
this works fine, but I need to get proper values depend on offer.person value, which could be: physician, nurse etc...
How can I change return value to be: in case of nurse:
computed: {
specialitySelect() {
return this.$store.state.nurseListSpeciality
}
}
If this would be a function I could easily do:
methods: {
specialitySelect(person) {
return this.$store.state[person]ListSpeciality
}
}
but in computed I cannot do it. Is there any other solution that I could use instead?
computedbefore I will send it as a propoffer.personcome from/live? You're omitting some crucial part of your code hereoffer.personis fromdata() {return {inside my component. I usedthis.$store.state.${offer.person}ListSpecialityinside props before and this worked fine