【发布时间】:2019-06-21 03:55:02
【问题描述】:
我们的应用有多个位置,每个位置都有一个由 a、b、c 或 d 组成的 accessGroup。 我们的用户有一组 accessGroups ['a', 'c'] 等。
在我们的位置页面上,myLocations 应返回 location.accessGroup 包含在其 accessGroup 数组中的位置。
computed: {
...mapState(['currentUser', 'locations', 'userProfile']),
}
myLocations: function() {
return this.locations.filter((location) => {
return location.accessGroup === this.userProfile.accessGroup
})
},
【问题讨论】:
标签: vue.js computed-properties