如何在挂载或创建的钩子中使用另一个计算属性



这是我的代码吗?

computed: {
posts() {
return this.$store.getters['posts/postsByUser']
},

loggedIn() {
return this.$store.getters['auth/check'];
},
user() {
return this.$store.getters['auth/user']
}
},
created() {
this.$store.dispatch('posts/fetchPostsByUser', this.user.id)
}

如果你需要更多的清关,请告诉我

使用Vue组件实例上可用的计算属性(用户(

created() {
this.$store.dispatch('posts/fetchPostsByUser', this.user.id)
}

最新更新