2.5.16
https://jsfiddle.net/jfyLx256/
Prefix a property with $_ and try to reference it within the component or template.
$_ prefixed properties should be rendered in template and available within the component.
$_ 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 [email protected].
This is expected: https://vuejs.org/v2/api/#data, You can access them with $data.$_foo
@chrisvfritz do you think we should add a note about them not being proxied in the style guide?
I definitely think this should be mentioned in the style guide. I've been using Vue for about six months now and until now didn't know about $data because I never needed to.
I can't recall any place in the documentation where it's actually used either, so I'd wager most people have forgot about it if they ever read it.
Edit: Thanks for the quick help though! Much appreciated :)
Actually... Since these property names are recommended and at least according to the style guide guaranteed to not conflict with Vue, doesn't it make more sense to just proxy them?
We had a discussion about this in a PR. Unfortunately, I don't remember which PR it was nor I remember the final outcome 😆
Encountered this behaviour because I just started to follow style guide more thoroughly. So now I seemingly should fill my mixins' methods/computed/hooks with messy stuff like this.$data.$_mixinName_itemName everywhere, which, in my opinion, unnecessarily hurts readability since, as @adriangoransson said, conflicts are not expected in this situation.
Where I can find this on docs? I've taken more than an hour just searching why my data property doesn't work... Would be better to just support dollar prefixed properties.
@VitorLuizC
Most helpful comment
@chrisvfritz do you think we should add a note about them not being proxied in the style guide?