How can I use computed property in lists. I am using VueJS v2.0.2.
Here\'s the HTML:
Maybe add another v-for that iterates through a one-item-long list:
{{fullName}}
Not nice, but that's what you're looking for: an object around that span that has a property called fullName that contains that specific value.
And it's not just a vanity feature, because we may need to use that value at more than one place, eg.:
I am {{fullName}}
You are {{fullName}}
Who is {{fullName}}?
My use case was that I was constructing dates in v-for loops (yes, another calendar), like:
Some rendering of a day like {{day.getYear()}} and
{{day.getMonth()}} etc.
(For brevity I omitted the :key="whatever" settings)
I admit that the nicest way would be to move that to a separate component, but if we create a new component for every two-liner like this, and use that component only at this single place, then we just pollute another namespace.
Maybe a v-let="day as new Date(...)" directive would be handy for such purpose.