Hacker News new | ask | show | jobs
by troupo 865 days ago
> I much prefer to have HTML with some JS sprinkled

That's not what vue templates are. It's three or four different templating DSLs in one.

v-for alone will show that it's not HTML with Javascript: https://news.ycombinator.com/item?id=28059397

And there's more: https://news.ycombinator.com/item?id=19199423

1 comments

> That's not what vue templates are. It's three or four different templating DSLs in one.

The pattern is very obvious?

If array: (value, index)=>void

If object: (value, key, index)=>void

If it's an array, it's the call signature for the args of the forEach method, i.e. (value, index)=>void, but can be assigned a function that's just (value)=>void if index is unneeded. If it's an object, it's an extension of the same logic with (value, key, index).

It's not 4 dsls in one, anymore than jsx is a 1000 markups in one.

> The pattern is very obvious?

It's not

> It's not 4 dsls in one, anymore than jsx

I "like" that when discussing these things everyone completely ignores everything, and focuses on one specific thing.

So, again. The claim was that Vue templates is "HTML + Javascript"

1. As v-for clearly shows it's not even close to Javascript, as there are no Javascript constructs that correspond to this

2. As everything else, not just v-for shows, it's neither HTML (so many custom attributes with extensions and shorcuts etc.) nor Javascript.