question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v-bind shorthand for equal property and attribute name

See original GitHub issue

What problem does this feature solve?

Sometimes we’re binding attributes to the props that have exactly the same name. So we could simplify v-bind:attr="attr" or :attr="attr" to just this: :attr.

What does the proposed API look like?

<Component :attr />

Equals to

<Component :attr="attr" />

Equals to

<Component v-bind:attr="attr" />

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

13reactions
leopiccioniacommented, Jul 5, 2018

With ES6 syntax, you can write:

<Component v-bind="{ foo, bar, baz}" />

That’s equivalent to:

<Component :foo="foo" :bar="bar" :baz="baz" />

More details on Vue API docs.

1reaction
Mouvediacommented, Jan 23, 2020

@leopiccionia can you handle camelcase to kebabcase conversion automatically ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Shorthand for `v-bind` in case when child component property ...
There is no shorthand in Vue for that. But, you can pass an object to v-bind and use the ES2015 property name shorthand:...
Read more >
vue/prefer-true-attribute-shorthand
Rule Details #. v-bind attribute with true value usually can be written in shorthand form. This can reduce verbosity.
Read more >
Binding syntax - Angular
Angular binding distinguishes between HTML attributes and DOM properties. ... other than interpolation have a target name to the left of the equal...
Read more >
What you should know about Vue v-model - LearnVue
Vue v-model is a directive that creates a two-way data binding between a value in our template and a value in our data...
Read more >
Attributes - C# language specification | Microsoft Learn
Each non-static public read-write field and property for an attribute class defines a named parameter for the attribute class.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found