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

fix: Script Setup Does Not Populate Name Property #2703

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

incutonez
Copy link

@incutonez incutonez commented Feb 19, 2024

#10348:

  • Adding clarification on how to access name property in script setup

Description of Problem

In script setup, the name property does not get created, per here.

Proposed Solution

In order to help clarify what can be used, it makes sense to add a reference to __name to help devs that need access to the component's name in script setup.

Additional Information

Original PR that introduced __name

- Adding clarification on how to access `name` property in script setup
Copy link

netlify bot commented Feb 19, 2024

Deploy Preview for vuejs ready!

Name Link
🔨 Latest commit 01094c3
🔍 Latest deploy log https://app.netlify.com/sites/vuejs/deploys/65d3916ae370800008ef896a
😎 Deploy Preview https://deploy-preview-2703--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.

@yyx990803
Copy link
Member

I don't think this should be added because the inference is an internal mechanism. Can you clarify your use case here?

@incutonez
Copy link
Author

incutonez commented Mar 13, 2024

I don't think this should be added because the inference is an internal mechanism. Can you clarify your use case here?

Absolutely! I use script setup, and I need to be able to reference the name of the component programmatically... according to the docs, I should be able to use name, but I can't because script setup sets __name, and it wasn't clear which property to use. I would rather not have to go through each component and use defineOptions({ name: "ComponentName" }); if the name is inferred from the file (which is what I want).

@flogehring
Copy link
Contributor

I use script setup, and I need to be able to reference the name of the component programmatically...

What are you doing with the name?

@incutonez
Copy link
Author

What are you doing with the name?

For display purposes, retrieving it for an include/exclude list in KeepAlive, and other use cases that apply for the Options API.

@bencodezen bencodezen added the state: awaiting-feedback Needs more input before further actions can be taken label Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: awaiting-feedback Needs more input before further actions can be taken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants