NIUCLOUD是一款SaaS管理后台框架多应用插件+云编译。上千名开发者、服务商正在积极拥抱开发者生态。欢迎开发者们免费入驻。一起助力发展! 广告
``` 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}) } } ```