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

Using props in initial data? #41

Closed
pearofducks opened this issue Dec 8, 2016 · 4 comments
Closed

Using props in initial data? #41

pearofducks opened this issue Dec 8, 2016 · 4 comments

Comments

@pearofducks
Copy link

pearofducks commented Dec 8, 2016

From the example in README there's:

// use prop values for initial data
  helloMsg = 'Hello, ' + this.propMessage

If I copy the full example into a component and use it, helloMsg is always undefined (even when the prop is set to a string). Should this be the case*? It works in other methods and such, but not in initial data.

*The wording in that comment makes it seem like this should not be undefined. :)

@ktsn
Copy link
Member

ktsn commented Dec 9, 2016

Thanks for reporting this.
I'm afraid, I could not reproduce this problem. What module bunder/transpiler are you using?

@pearofducks
Copy link
Author

Here's an example repo.

@ktsn
Copy link
Member

ktsn commented Dec 11, 2016

The cause seems to be missing inheritance of Vue class. Adding extends Vue to Comp class solves this issue.
I'll update README and add a warning message for that...

@ktsn
Copy link
Member

ktsn commented Dec 17, 2016

A warning message will be printed on v4.4.0 or later.

@ktsn ktsn closed this as completed Dec 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants