getters: {
getProductByid: (state) => (id) =>
{
return state.productList.find(item => item.id === id);
}
}
在使用了namespace的情况下调用:
this.$store.getters['yournamespace/getProductByid'](id);
在未使用namespace的情况下调用:
this.$store.getters.getProductByid(id);