You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can make your component `data`properties update from any Meteor reactive sources (like collections or session) by putting an object for each property in the `meteor` object. The object key is the name of the property (it shouldn't start with `$`), and the value is a function that returns the result.
106
+
You can add reactive properties that update from any Meteor reactive sources (like collections or session) by putting an object for each property in the `meteor` object. The object key is the name of the property (it shouldn't start with `$`), and the value is a function that returns the result.
107
107
108
108
Here is an example:
109
109
110
110
```js
111
111
exportdefault {
112
112
data() {
113
113
return {
114
-
selectedThreadId:null,
115
-
// We can init the property value in the data() component hook
116
-
threads: [],
117
-
selectedThread:null
114
+
selectedThreadId:null
118
115
}
119
116
},
120
117
meteor: {
@@ -124,8 +121,7 @@ export default {
124
121
'threads': []
125
122
},
126
123
// Threads list
127
-
// This will update the 'threads' array property on the Vue instance
128
-
// that we set in the data() hook earlier
124
+
// You can access tthe result with the 'threads' property on the Vue instance
129
125
threads () {
130
126
// Here you can use Meteor reactive sources
131
127
// like cursors or reactive vars
@@ -135,7 +131,6 @@ export default {
135
131
})
136
132
},
137
133
// Selected thread
138
-
// This will update the 'selectedThread' object property on component
139
134
selectedThread () {
140
135
// You can also use Vue reactive data inside
141
136
returnThreads.findOne(this.selectedThreadId)
@@ -144,8 +139,6 @@ export default {
144
139
})
145
140
```
146
141
147
-
You can skip the data initialization (the default value will be `undefined`).
0 commit comments