合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
在组件xx.vue文件中取值 ``` 第一种 computed:{ count(){ return this.$store.state.count } count1(){ return this.$store.state.count1 } } ``` 简写xx.vue文件中 ``` 第二种 import { mapState } from"vuex" computed:mapState({ count : 'count', count1 : 'count1' }) ``` ``` 第三种 computed : mapState({ ['count','count1'] }) 哪如果要计算其他怎样办? ``` ``` ...{ count(){ return this.$store.state.count } count1(){ return this.$store.state.count1 } } computed :{ total(){ return this.arr.reduce((prev,curr)=>{ return curr + prev }) } ...mapState(['count','count1']) } ```