2

Learning vue and it's lovely, except FUCKING V-MODEL I'm literally 10 hours of tutorials in and I still have no clear idea what the thing does, I'm pretty sure it's like 2/10 complexity thing but someone just HAD TO name it V-MODEL so that it doesn't give you a slightest hint of the actual functionality, like you might as well have named it v-cable or v-oompaloompa, it would have the exact same information value (none).

Comments
  • 2
    v-model is what you'd call a primary change factor of the component and it's bound two ways (shorthand of setter event and getter prop). On checkboxes it will be the same as enabling/disabling "checked". On inputs and other elements it's "input" event and "value" prop, usually.

    However, what really helps it to be explicit and talk in one language with the adopter of your component - a prop with "sync" mod.
  • 3
    It's just a fancy binding. If I remember correctly, v-model="foo" is basically a shorthand for :value="foo" and @input="x => foo = x"
  • 1
    I'd say is a shortcut for the child component to be able to modify a piece of data in the parent component. If a component accepts v-model binding, then often the main purpose of that component is to modify that piece of data
Add Comment