Skip to content

Added a note about prop modifiers on render function examples #1712

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

Merged
merged 5 commits into from
May 13, 2022

Conversation

NataliaTepluhina
Copy link
Member

@NataliaTepluhina NataliaTepluhina commented May 12, 2022

Description of Problem

See #1649

Proposed Solution

Add a shorthand for .attr in the directives guide and a note on how to use modifiers in the render function

Close #1649

@netlify
Copy link

netlify bot commented May 12, 2022

Deploy Preview for vuejs ready!

Name Link
🔨 Latest commit 1922783
🔍 Latest deploy log https://app.netlify.com/sites/vuejs/deploys/627d23f184f6a700085b46a2
😎 Deploy Preview https://deploy-preview-1712--vuejs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@@ -328,6 +328,15 @@ Dynamically bind one or more attributes, or a component prop to an expression.
<div .someProperty="someObject"></div>
```

The `.attr` modifier has a shorthand `^`:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the ^ template shorthand should be documented.

It was documented previously but we reverted it because it doesn't work. See #1658. After that PR was merged I confirmed with Evan that this is intentional and it shouldn't be included in the docs.

To be clear, it is specifically the template shorthand that doesn't work. Using it as a prefix in a render function works fine.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@skirtles-code thanks! Removed the added part from directives doc

@@ -39,6 +39,9 @@ h('div', { id: 'foo' })
// Vue automatically picks the right way to assign it
h('div', { class: 'bar', innerHTML: 'hello' })

// props modifiers such as .prop and .attr can be added via shorthands
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this explanation will need tweaking, as we can't document ^ as a shorthand.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the explanation

@skirtles-code skirtles-code merged commit 6fa4ba4 into main May 13, 2022
@skirtles-code skirtles-code deleted the add-props-to-render-functions branch May 13, 2022 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add doc for .attr and .prop modifier usage in render function.
2 participants