[Vuejs]-Convert api response array to another array to pass to Vue prop

3👍

You can use JavaScript “map” function. This function takes one array and return a new one.

// If this is the response array....
const response = [{name: 'image 1', url: 'https://uri.com/img1'}, ...]


// Then you return something like this
response.map(item => {
    return {
       ...item,
       image_full: item.url
    }
})

Leave a comment