I have some template code which looks something like this:
<div v-for="n in appStore.yearsToCompute" :key="n">
<span>{{ n + appStore.startingYear - 1 }}: {{ yearMap.get(n + appStore.startingYear - 1).name }}, {{ yearMap.get(n + appStore.startingYear - 1).salary }}</span>
</div>
I am using properties of properties and indexes of properties and it is a lot of repeat code. I am wondering if Vue has some kind of “with” statement so I can resolve the value once, making my template code look much cleaner and smaller, i.e.:
<div v-for="n in appStore.yearsToCompute" :key="n">
<WITH year="n + appStore.startingYear - 1" data="yearMap.get(year)">
<span>{{ year }}: {{ data.name }}, {{ data.salary }}</span>
</WITH>
</div>
Thanks