Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add docs addressing "$attrs no longer contains events declared in the emits option" issue #3055

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

Draft
stevebauman wants to merge 2 commits into vuejs:main
base: main
Choose a base branch
Loading
from stevebauman:patch-1

Conversation

Copy link

@stevebauman stevebauman commented Oct 9, 2024

Description of Problem

There is a long-standing discussion from 2021 with comments as recent as September 6th on the disappearance of event listeners in $attrs when those events are declared in the emits property:

vuejs/rfcs#397

This is documented here, but with no solution proposed:

https://vuejs.org/api/options-state.html#emits

Screenshot 2024年10月09日 at 11 17 47 AM

Proposed Solution

Additional docs can be added for those who discover that this occurs so that developers can properly utilize this un-documented functionality in Vue (or, if the docs do exist, correct me if I'm wrong) that allows developers to create props for these event listeners that Vue will auto-populate if they conform to a specific naming convention.

Additional Information

N/A

Copy link

netlify bot commented Oct 9, 2024
edited
Loading

Deploy Preview for vuejs ready!

Name Link
🔨 Latest commit 636f4b3
🔍 Latest deploy log https://app.netlify.com/sites/vuejs/deploys/67069fadc029f4000787dec3
😎 Deploy Preview https://deploy-preview-3055--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 configuration.

Copy link
Member

@stevebauman

If we want to add this part of the documentation, let's start with why do we want/need to check on the event. Otherwise the use-case is not clear (I know there are examples in the thread, but we need some "you might find yourself in a need to check for a listener bound).

Copy link
Author

@NataliaTepluhina Ok sounds good! Would you be able to share an example of the style you may be looking for from an existing doc page so I can write it in the format that you may be expecting? 🙏

The existing docs on this API page don't share any "why"'s, only "how"'s...

Copy link
Member

@stevebauman a good example can be a beginning of the Forms section in the Guide: https://vuejs.org/guide/essentials/forms.html - we show first how we could do it with our "known" tools and then introduce v-model. Here, we could say that "there might be a case where you need to know about passed listeners (case example)" and then proceed with explaining how. Personally, I never had the need to check for the existing listener so you might need to come with "real" example yourself

stevebauman reacted with thumbs up emoji

Copy link
Author

Ok thanks @NataliaTepluhina! Marking as draft and will update this a few hours (away from computer atm) and will mark ready once good to go for re-review.

@stevebauman stevebauman marked this pull request as draft October 29, 2024 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /