vuex辅助函数
mapState 当一个组件需要获取多个状态时候,将这些状态都声明为计算属性会有些重复和冗余。 原本 computed: { count () { return this.$store.state.count }, count1 () { return this.$store.state.count }, count2 () { return this.$store.state.count }, count3 () { return this.$store.state.count } } 现在 computed: mapState({ // 箭头函数可使代码更简练 count: ..
更多