流星vue跟踪器不获取反应性数据



我将meteor与vue一起使用,并使用meteor-vue-tracker进行反应数据。当我从跟踪器返回集合时,数据首先作为空数组出现两次,第三次作为数据出现。但是在我的一些 vue 组件中,跟踪器只运行两次,因为我只在第三次获取数据,数据在特定组件中作为空数组返回。为什么会这样?流星跟踪器默认运行多少次,我们如何强制跟踪器运行?

示例代码:

meteor: {
$subscribe: {
'notes': []
},
async dataTrack() {
if(Meteor.status().connected){
this.data = Notes.find().fetch();
}else{
if(this.$pouch){
this.data = await this.$pouch.find({
selector: {
_id: {$gte: null}
},
},'notes').then(function(result){
return result.docs;
});
}
}
}
}

Vue 跟踪器通常会运行两次而不订阅集合。如果我们订阅带有流星vue跟踪器的集合,它会运行三次。就我而言,订阅没有等效的出版物。

最新更新