0👍
once you have loaded data from getNames
, you can then easily mirror the state in the component with mapState:
computed: {
...mapState('namesAll', state => state.namesAll)
},
0👍
You can use mapGetters
of vuex
.
This is a example:
vuex
const state = {
names: {
all: []
}
}
const getters = {
nameAll: state => state.name.all
}
view.vue
<template>
<span>{{ nameAll }}</span>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
computed: {
...mapGetters(['nameAll'])
}
}
</script>
- [Vuejs]-Why the url become like this(add ? before #) after redirecting and how can I redirect correctly
- [Vuejs]-Setting default to 0 in vuechart.js HorizontalBar
Source:stackexchange.com