在組件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'])
}
```