Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add syntax to bind to properties instead of attributes #2819
Add syntax to bind to properties instead of attributes #2819
Changes from 8 commits
971eaa8
2177f8c
27efd0a
866dbe6
b0c0126
0bb8cd5
66e714c
ea353cc
43ab9d0
9b418bf
5e8c4c4
00deee5
0107f03
1eea41a
3b9fa16
b8cf9b8
ec4f599
dfd2082
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's discuss some syntax and why I think using
@
is not not intuitive.@{}
is used for dynamic tags already. We're currently not supporting dynamic attribute names, but if we were to, I'd reuse the syntax there. Since this feature does something else, I find it confusing.@click
=v-on:click
= a callback on the click event. And there's a directive for attribute binding,:href
=v-bind:href
= sets the attribute of the element.My preferred solution: use
Token![:]
, i.e.:attr-name
. An eventual dynamic attribute name would look like:@{expr}={value}
. When we want to support further directives, we could use#[attr] attr-name={value}
and#[on] event={handler}
(not so sure about a short-hand form for event handlers,$click
?).Can we also support a syntax such as
.prop-name
(or#[prop] prop-name
) to explicitly assign to a property? This is important for the complication with the property reflecting an attribute not being always named the same. See below on the comment about"class"
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #2819 (comment)