【发布时间】:2021-02-12 14:07:36
【问题描述】:
你好,这是我的计算方法:
computed:
mapState({
aftermovie: (state) => state.festival.aftermovies[id]
}),
id: {
set() { return this.$route.params.id}
},
如果我输入 state.festival.aftermovies [0] 它可以工作,但如果我尝试在 url 中获取 id,id 是未定义的,你能帮我吗
【问题讨论】:
-
这应该可以
state.festival.aftermovies[this.$route.params.id]
标签: vue.js vuex computed-properties mapstatetoprops