0๐
As I understand, you just want to rename the keys of data objects you retrieve from the server.
This should do it:
getlist() {
this.$http.get('/getlist')
.then(res => {
let list = [];
for (let item of res.data) {
let newItem = {
category_name: item.name,
companies: item.company
}
list.push(newItem);
}
this.lists = list;
})
.catch(err => {
console.error('Error retrieving "/getlist":', err)
});
}
๐คuser9246109
Source:stackexchange.com