Is there a way to pass parameter into getter of vuex
store
?
Something like:
new Vuex.Store({
getters: {
someMethod(arg){
// return data from store with query on args
}
}
})
So that in component I could use
<template>
<div>
<p>{{someMethod(this.id)}}</p>
</div>
</template>
<script lang="ts">
import { mapGetters } from "vuex"
export default {
props: ['id'],
computed: mapGetters(['someMethod'])
}
}
</script>
but in vuex first argument is state
and second is other getters
. Is it possible?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…