there is an object:
{ "id": ", "name":" }
need to do =>
{ "value": ", "label":" }
I have written so
computed: { ...mapState({ categories: state => state.main_page.NEWS }), getCategories() { let arr = []; let categories = this.categories; categories.forEach(function(obj) { obj['value'] = obj['id']; obj['label'] = obj['name']; delete obj['id']; delete obj['name']; arr.push(obj) }) return arr } }
everything works. but he changed this.categories
How to make the original source was the old name of the keys created with new?