question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Private properties prefixed with `$_` (dollar underscore) are not available inside component

See original GitHub issue

Version

2.5.16

Reproduction link

https://jsfiddle.net/jfyLx256/

Steps to reproduce

Prefix a property with $_ and try to reference it within the component or template.

What is expected?

$_ prefixed properties should be rendered in template and available within the component.

What is actually happening?

$_ props are undefined. Not rendered in template and undefined in component logic.


Private property names are described in the Vue style guide and the $_ form is officially recommended. https://vuejs.org/v2/style-guide/#Private-property-names-essential.

I first noticed this in a project built with vue-cli@3.0.0-beta.16.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
posvacommented, Jun 29, 2018

@chrisvfritz do you think we should add a note about them not being proxied in the style guide?

3reactions
Justineocommented, Sep 28, 2018
Read more comments on GitHub >

github_iconTop Results From Across the Web

What does the dollar prefix ($) mean in Vue.js? - Stack Overflow
$ is for public instance properties: As for the $ prefix, its purpose within the Vue ecosystem is special instance properties that are...
Read more >
I cannot to dollar sign($) to reference any property wrappers ...
The $ prefixed property for your property wrapper returns the value that you have as your property wrapper's projectedValue property. If you don ......
Read more >
Do you use underscores and dollarsigns in your code? - Reddit
Private fields were introduced based on this underscore pattern. You should definitely use them instead of underscores, as they make the ...
Read more >
Google TypeScript Style Guide
Do not use trailing or leading underscores for private properties or methods. Do not use the opt_ prefix for optional parameters.
Read more >
Name and organize components - Figma Help Center
Not sure where to start with building a Component Library? ... Expanded menu in Assets Panel showing Components within the file.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found