我正在尝试传递一个参数来存储。$ dispatch,但是如果我从数据中调用数据,它说该数据是未定义的。
为什么这不起作用:
data () {
return {
year: '2019'
}
},
async fetch({store}) {
await store.dispatch('posts/fetchAll', this.year)
},
但是这样做:
async fetch({store}) {
await store.dispatch('posts/fetchAll', '2019')
},
我正在使用veux和nuxt。
文档说: