Created
September 19, 2018 12:32
-
-
Save ayushgupta11/7eeb1a4fdfeadab1a94a1e592ecd53dd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="container"> | |
{{computeListData}} | |
</div> | |
</template> | |
<script> | |
export default { | |
computed: { | |
computeListData(){ | |
let newList = [] | |
this.soundpacks.forEach((item) => { | |
let data = this.genres.filter((genre) => { | |
return (genre.id === item.genre_id) | |
}) | |
let listData = item | |
listData.label = data[0].label | |
newList.push(listData) | |
}) | |
return newList | |
} | |
}, | |
data(){ | |
return{ | |
genres: [ | |
{ | |
id: 1, | |
label: 'Techno' | |
}, | |
{ | |
id: 2, | |
label: 'Deep House' | |
} | |
], | |
soundpacks: [ | |
{ | |
title: 'Techno soundpack', | |
tempo: 130, | |
genre_id: 1, | |
teacher_id: 1 | |
}, | |
{ | |
title: 'Deep House soundpack', | |
tempo: 123, | |
genre_id: 2, | |
teacher_id: 2 | |
} | |
] | |
} | |
} | |
} | |
</script> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment