【发布时间】:2020-10-09 11:13:01
【问题描述】:
在我正在运行的父级上:
mounted(){
this.$store.dispatch('fetchNotesAction')
},
components: { ChildComponent }
这样,Vuex 存储就会填充数据。
因此,我假设在子组件运行时,商店已经满了。
在ChildComponent我正在尝试这个
mounted(){
console.log(this.$store.getters.getNotes)
},
如果我在父项中记录完全相同的代码,则在 dispatch 之后它会显示数据。所以这些行后面的代码(连接)工作正常,只是我假设我不需要再次重新运行提取(来自fetchNotesAction)是正确的吗?
我试过 created 而不是 mounted 和同样的事情
【问题讨论】:
标签: vue.js vue-component vuex