Readit News logoReadit News
ohceecho commented on How and why we moved to Vue.js   mkdev.me/en/posts/how-and... · Posted by u/fodoj
fbonetti · 8 years ago
How is that not two-way binding? The Vue documentation even calls it two-way binding:

“You can use the v-model directive to create two-way data bindings on form input and textarea elements.”

https://vuejs.org/v2/guide/forms.html

ohceecho · 8 years ago
Yeah, the documentation should probably reflect that. It works like shallow two-way binding, but it implemented differently. Instead of using observers on the data itself, it uses an event, thus maintaining a cleaner interface between the components and avoiding the performance problems and bugs that come with two-way binding.

`v-model` is just a syntax sugar to save you from typing `v-bind:value="val" v-on:input="val = $event.target.value"` over and over. Nothing more than that.

ohceecho commented on How and why we moved to Vue.js   mkdev.me/en/posts/how-and... · Posted by u/fodoj
FlorianRappl · 8 years ago
Personally, I think one of the best things of React is that it left out two-way binding on purpose. I agree, that sometimes people write a lot of boilerplate therefore, but at least it can be understood (and modified) easily. Advanced people write nice re-usable functions with the same effect, but less boilerplate.
ohceecho · 8 years ago
v-model in Vue is not exactly two-way binding. It is just syntax sugar for passing the value as a prop and setting an event handler for the “input” event. It looks like two-way binding but has none of the gotchas.

I agree with you point btw.

ohceecho commented on How and why we moved to Vue.js   mkdev.me/en/posts/how-and... · Posted by u/fodoj
ourmandave · 8 years ago
I'd love to read the follow up article 1 year from now. And then 3 years, and 5 and 10.

Vue 2.0 was a complete rewrite and their "long-term-support" for v1 was 9 months of security updates.

I'm not trying to single out Vue, but I wonder how many job posting are for someone to maintain a legacy framework code base. (Legacy meaning 6 months old.)

ohceecho · 8 years ago
Anecdotal, but I had to migrate a mid-sized app (about 400 components) from Vue 1 to Vue 2 and it took less than a day of work to modify the code, test it and push to production. We weren't using that many removed features to begin with, though.
ohceecho commented on How and why we moved to Vue.js   mkdev.me/en/posts/how-and... · Posted by u/fodoj
amelius · 8 years ago
> The official website includes a way to use it by just including a script from the CDN, on the "Get Started" page.

But how about an explanation of how to compile the .vue files (used in the examples) to JS? Or how to do without them?

ohceecho · 8 years ago
You mean the examples in the link I posted? Those are just javascript and HTML, there's nothing special about them.

Just put that on an HTML file and run it in a browser. No need for any tool other than a text editor.

To compile .vue files you have to use vue-cli (linked on the "Get Started" page), or some third-party tool (instructions here: https://vuejs.org/v2/guide/deployment.html).

ohceecho commented on How and why we moved to Vue.js   mkdev.me/en/posts/how-and... · Posted by u/fodoj
erokar · 8 years ago
I don't get the Vue hype. Sure, Vue seems nice enough, but it is concepteually very similar to React, so nothing new there. The pros of React are a smaller API and JSX instead of an added templating language (the latter being a contentious issue, I know).

EDIT: I realize now Vue does have optional support for JSX and you are not forced to use a templating language.

ohceecho · 8 years ago
The templating language is entirely optional. People use it because they prefer it.

You can even use JSX if you want.

ohceecho commented on How and why we moved to Vue.js   mkdev.me/en/posts/how-and... · Posted by u/fodoj
amelius · 8 years ago
I tried to use Vue.js recently, but found that there's a huge set of idiomatic coding principles, as opposed to a small set of primitives. Which basically makes it not for me.

What I also disliked was how they don't explain how to get it working without a build-environment like webpack. That makes it really a "framework" in the sense that it's all-or-nothing. Again, not my style. I prefer self-contained libraries.

ohceecho · 8 years ago
I disagree with the assertion that it has "huge set of idiomatic coding principles", but I think that's a matter of opinion.

However:

> What I also disliked was how they don't explain how to get it working without a build-environment like webpack.

This doesn't make sense. The official website includes a way to use it by just including a script from the CDN, on the "Get Started" page. It even discourages using the build tools if you don't have prior experience: https://vuejs.org/v2/guide/

u/ohceecho

KarmaCake day26February 11, 2018View Original