vue-meteor-tracker
vue-meteor-tracker copied to clipboard
How to pass `this.$subReady.posts` to data prop (reactive)?
{{!$subReady.posts}} // work fine
{{loading}} // don't reactive
----------
data() {
return {
loading: true
};
},
meteor: {
$subscribe: {
posts: []
},
loading(){
return !this.$subReady.posts;
},
I try watch
, but still don't work
watch:{
'$subReady.posts':function(val){
this.loading = val;
}
}
It should work with a computed.
export default {
meteor: {
$subscribe: {
posts: [],
},
},
computed: {
isLoading() {
return !this.$subReady.posts;
},
},
};