modified code

This commit is contained in:
Matthis FAUVET 2024-06-21 01:59:44 +02:00
parent b51e9b1073
commit 04ebf91d92

View File

@ -16,15 +16,11 @@
<script> <script>
export default { export default {
async onBeforeMount(props){ onBeforeMount(props){
document.getElementById("album").style.backgroundColor = "#6EE7B7"; document.getElementById("album").style.backgroundColor = "#6EE7B7";
document.getElementById("album").style.borderColor = "#059669"; document.getElementById("album").style.borderColor = "#059669";
this.state.placeholder = 'Rechercher dans les albums'; this.state.placeholder = 'Rechercher dans les albums';
this.state = {
placeholder: "caca",
items: await this.fetchSong()
};
console.log(this.state); console.log(this.state);
}, },
@ -60,12 +56,17 @@
document.getElementById("artist").style.backgroundColor = "#D1FAE5"; document.getElementById("artist").style.backgroundColor = "#D1FAE5";
document.getElementById("artist").style.borderColor = "#6EE7B7"; document.getElementById("artist").style.borderColor = "#6EE7B7";
}, },
async fetchSong(){ async test(){
this.state = {
placeholder: "caca",
items: await this.fetchSong()
};
},
fetchSong(){
return fetch("https://dwarves.iut-fbleau.fr/~fauvet/api/songs").then(response => { return fetch("https://dwarves.iut-fbleau.fr/~fauvet/api/songs").then(response => {
return response.json(); return response.json();
}); });
},
}
} }
</script> </script>
</onzer> </onzer>