My fetch method retrieves recordings from the database, but I need to prepend a new record to the existing data for frontend purposes. Can someone assist me with this?
<script>
export default {
components: {
},
data: function() {
return {
versions: [],
};
},
created: function() {
this.fetchVersions();
},
methods: {
fetchVersions() {
var that = this;
var url = '/area/versions.json';
this.$axios.get(url)
.then(response => {
that.versions = response.data;
})
},
}
};
</script>
At present, the `versions` array looks like this:
versions: [
{
name: 'Version 1',
region: 'CBA 09',
},
{
name: 'Version 2',
region: 'CBA 11',
}
]
I would like to insert the following record at the beginning of `versions`:
{
name: Version 3
region: CBA 21
}
So that the `versions` array appears as follows:
versions: [
{
name: Version 3
region: CBA 21
},
{
name: 'Version 1',
region: 'CBA 09',
},
{
name: 'Version 2',
region: 'CBA 11',
}
]
If anyone knows how I can achieve this, please provide your assistance.