-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
this undefined in Reactive data #77
Comments
if the variable is coming from a prop it is OK: export default { data() { meteor: {
|
all reactive data, computed properties are undefined the fisrt time It seems VueMeteor is added before |
That is correct, vueMeteor uses beforeCreate https://github.com/meteor-vue/vue-meteor-tracker/blob/441a6ad2b125862a804e1a7b394a521749a14990/src/index.ts#L204C24-L204C24 |
However, you can do it from the mounted hook instead. You can use this.$subscribe form there and if you need reactive variables you can wrap the $subscribe in an autorun. Just make sure you still have an empty meteor: {} object. |
I use vue3 and vue-meteor-tracker 3.0.0beta7.
When I try to use 'this' in Reactive data, i got undefined.
In fact, it works when I use for example 'this.$store...' but not if I use 'this' with variables defined into 'data()' or 'computed()'.
The text was updated successfully, but these errors were encountered: