@ahopkins wrote:
Is there such as thing as dynamic
computed
properties? I think a bit of code would make more sense.Let’s say there is an object like this:
const fruitVendor = { weeks: { '2018-10-07': { available: ['apples', 'bananas', 'pears'] }, ... }, ... }
The data will always be in this format:
fruitVendor.weeks.<YYYY-MM-DD>.available
.There could be a lot
weeks
, but I may only care about a computed property on this week. Right now I need to do something like this:myComputedProperty: computed('fruitVendor.weeks', ...)
Whereas, ideally, I had something like this:
myComputedProperty: computed('fruitVendor.weeks.<getThisWeek()>.available', ...)
How do you handle something like this?
Posts: 3
Participants: 2