Skip to content

Vue props throw incomprehensible error when passing variables starting with symbols #8213

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

Closed
mcskeeled opened this issue May 21, 2018 · 2 comments · Fixed by #8214
Closed
Assignees

Comments

@mcskeeled
Copy link

Version

2.5.17-beta.0

Reproduction link

https://codesandbox.io/s/r0lr534k94

Steps to reproduce

Open the console and see the error:

proxyConsole.js:72 [Vue warn]: Property or method "$_testMixin_testData" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.

found in

---> <TestMixin> at /src/App.vue
       <Root>

What is expected?

It's expected for the prop to be defined

What is actually happening?

The prop is undefined if the variable contains symbols in the beginning


I am not completely sure if this is a bug or intended, since I think it is a bug I opened this issue, yet if this is intended the error shown should be giving more details, it took me some time to understand what was the error because it isn't clear just from the error message.

@Justineo
Copy link
Member

See https://vuejs.org/v2/api/#data:

Properties that start with _ or $ will not be proxied on the Vue instance because they may conflict with Vue’s internal properties and API methods. You will have to access them as vm.$data._property.

@mcskeeled
Copy link
Author

I understand that, yet I was following the style guide for mixins:
https://vuejs.org/v2/style-guide/#Private-property-names-essential

And still the error message is not comprehensible, the developers should be able to fix this problem without reading the whole docummentation, in other words I think a better error message would be more appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants