读取store的字段值,通过this.$store.state访问 const Counter = { template: `<div>{{ count }}</div>`, computed: { count () { return this.$store.state.count } } } 复制代码 mapState 辅助函数 当一个组件需要获取多个状态时候,将这些状态都声明为计算属性会有些重复和冗...
读取store的字段值,通过this.$store.state访问 const Counter = { template: `<div>{{ count }}</div>`, computed: { count () { return this.$store.state.count } } } 复制代码 mapState 辅助函数 当一个组件需要获取多个状态时候,将这些状态都声明为计算属性会有些重复和冗...