3 ms·
> As soon as I see "el: #id" it's basically over for me. There's literally only one of those, to tell what element in the HTML to bind the root Vue instance to
by ceejayoz 10y ago
> As soon as I see "el: #id" it's basically over for me.
There's literally only one of those, to tell what element in the HTML to bind the root Vue instance to. Vue doesn't require thinking about the DOM.
It's the same sort of thing as React's basic tutorial (https://facebook.github.io/react/docs/getting-started.html https://facebook.github.io/react/docs/getting-started.html)
ReactDOM.render(
<h1>Hello, world!</h1>,
document.getElementById('example')
);
- linkmotif 10y agoOh really? That is good! I was hoping that would be the case, and that my comment would inspire someone to enlighten me. Thank you!
- linkmotif 10y agoPS. What if you're the kind of person who likes coupling presentation and logic? I really like JSX and inline styles. From my skimming, it appears Vue separates templates and logic. Is that correct?
- swsieber 10y agoThen write vue as single file components: https://vuejs.org/guide/single-file-components.html https://vuejs.org/guide/single-file-components.html
- nogridbag 10y agoOn the contrary, for most larger apps you'll want to use single file components + webpack. I'm also a big fan of keeping markup, styles, and logic close together and Vue's single file components are one of my favorite features compared to React components: http://vuejs.org/guide/single-file-components.html http://vuejs.org/guide/single-file-components.html The only downside is that while .vue files do have editor support in most editors, it's still not 100%. For example there are two plugins for VS Code but neither of them are really usable at this time.