modified code
This commit is contained in:
parent
7e2bb9a22e
commit
7460ef7905
10
index.html
10
index.html
@ -16,16 +16,18 @@
|
|||||||
<script type="javascript" src="./onzer.riot"></script>
|
<script type="javascript" src="./onzer.riot"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
async function fetch_data(){
|
function fetch_data(){
|
||||||
return fetch("https://dwarves.iut-fbleau.fr/~fauvet/api/albums").then(response => {
|
return fetch("https://dwarves.iut-fbleau.fr/~fauvet/api/albums").then(response => {
|
||||||
return response.json();
|
return response.json();
|
||||||
} )
|
} )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function wait_data(){
|
||||||
|
return await this.fetch_data()
|
||||||
|
}
|
||||||
|
|
||||||
riot.compile().then(() => {
|
riot.compile().then(() => {
|
||||||
riot.mount('onzer', {
|
riot.mount('onzer', {items: wait_data()}
|
||||||
items : await fetch_data()
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
13
onzer.riot
13
onzer.riot
@ -30,12 +30,13 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
onBeforeMount(props){
|
onBeforeMount(props){
|
||||||
this.state = {
|
this.state = {
|
||||||
placeholder: "Rechercher dans les albums",
|
placeholder: "Rechercher dans les albums",
|
||||||
search: "albums"
|
items: props.results,
|
||||||
};
|
search: "albums"
|
||||||
this.paintButton();
|
};
|
||||||
this.album_style = "isActivate";
|
this.paintButton();
|
||||||
|
this.album_style = "isActivate";
|
||||||
},
|
},
|
||||||
onMounted(){
|
onMounted(){
|
||||||
this.update();
|
this.update();
|
||||||
|
Loading…
Reference in New Issue
Block a user