two methods-sharp-sharp-sharp problem description
Why can"t the first of the following be obtained with mapgetters
the environmental background of the problems and what methods you have tried
related codes
/ / Please paste the code text below (do not replace the code with pictures)
const store = new Vuex.Store({
state: {
arr:[
{id:1,name:"",score:80},
{id:2,name:"",score:59},
{id:3,name:"",score:80}
]
},
getters: {
//
arrList:function(state){
return state.arr.map(function(item){
return item.score >= 60 ? "" : ""
})
}
//es6
arrList: state=> state.arr.map(item => item.score >= 60 ?"":"")
}
})
export default store;
computed: {
//arrList
arrList:function(){
return this.$store.getters.arrList
},
//arrList
...mapGetters([
"getType",
"arrList"
])
},
what result do you expect? What is the error message actually seen?
Why can"t the first method in getters be obtained with mapgetter? ask for advice