import { mapState } from 'vuex'
...mapState({
user: (state) =>{
return _.filter(state, data => {
return _.includes(this.allUserIds, data.id)
} )
}
})
in this case, I won't call this.allUserIds in map state
import { mapState } from 'vuex'
...mapState({
user: (state) =>{
return _.filter(state, data => {
return _.includes(this.allUserIds, data.id)
} )
}
})
in this case, I won't call this.allUserIds in map state
Don't use () => {} function syntax because it is binding this too early.
...mapState({
user(state) { // <--- here
return _.filter(state, data => {
return _.includes(this.allUserIds, data.id)
})
}
})