```
index.js文件
state: {
count: 0,
count1: 0,
goods: [
{id: 1, name: '连衣裙', isShow: true},
{id: 2, name: '裤子', isShow: false},
{id: 3, name: '袜子', isShow: false},
{id: 4, name: '鞋子', isShow: true},
]
}
getters :{
showGoods(state){
return state.goods.filler(item=>{item.isShow)
}
}
```
```
xx.vue文件
computed :{
total(){
return this.$store.getters.showGoods
},
...mapState(['count', 'count1']),
...mapGetters(['showGoods']),
...mapMutations([]),
...mapState({
goods : state => state.goods.filter(item=>{item.isShow)}
}),
goods(){
return this.$state.goods.filer(item=>{item.isShow})
}
}
```