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