Skip to content
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 docs addressing "$attrs no longer contains events declared in the emits option" issue #3055

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

stevebauman
Copy link

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

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.

@NataliaTepluhina
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).

@stevebauman
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...

@NataliaTepluhina
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
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants