ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、视频、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
在组件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']) } ```