-
Notifications
You must be signed in to change notification settings - Fork 4.8k
fix: Script Setup Does Not Populate Name Property #2703
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
Conversation
- Adding clarification on how to access `name` property in script setup
✅ Deploy Preview for vuejs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
I don't think this should be added because the inference is an internal mechanism. Can you clarify your use case here?
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).
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?
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.
Uh oh!
There was an error while loading. Please reload this page.
#10348:
name
property in script setupDescription of Problem
In
script setup
, thename
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 inscript setup
.Additional Information
Original PR that introduced
__name