3 ms·
It's perfectly possible to refer to the `item` in the loop template: <li v-for="item in items" :title="item.hint"> {{ item.message }} </li> I really don't
by ultrarunner 7y ago
It's perfectly possible to refer to the `item` in the loop template:
<li v-for="item in items" :title="item.hint"> {{ item.message }} </li>
I really don't have a problem thinking of them as templates. In a sense that's all we can do anyway with dynamic lists— I don't know how React works but it seems disadvantageous to be forced to run the loop again rather than be able to do a diff & DOM insert/splice behind the scenes.
My only real complaint is that the HTML attribute gets lost a little too easily. I could probably hack up some syntax highlighting augmentations to fix that, but it doesn't really bother me enough.
For what it's worth, JSX is supported in Vue as well, although I've found it's not really my thing compared to Vue templates.