@@ -3,10 +3,12 @@ import Wish from '../components/Wish.vue';
|
||||
import {ref, onMounted} from 'vue';
|
||||
import axios from 'axios';
|
||||
import TopFleur from '../components/TopFleur.vue';
|
||||
import WishPanel from '../components/WishPanel.vue';
|
||||
|
||||
let interval;
|
||||
|
||||
const wishes = ref([]);
|
||||
const selected = ref(-1);
|
||||
|
||||
const call = () => {
|
||||
axios
|
||||
@@ -16,6 +18,10 @@ const call = () => {
|
||||
})
|
||||
}
|
||||
|
||||
function selectedWish(index) {
|
||||
selected.value = index;
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
call();
|
||||
interval = setInterval(call, 10000);
|
||||
@@ -26,8 +32,9 @@ onMounted(() => {
|
||||
<template>
|
||||
<TopFleur></TopFleur>
|
||||
<body>
|
||||
<template v-for="wish in wishes">
|
||||
<Wish :wish="wish"/>
|
||||
<template v-for="(wish, i) in wishes">
|
||||
<Wish :wish="wish" :selected="selected==i" :index="i" @selectedWish="selectedWish" v-if="selected == i || selected == -1"/>
|
||||
<WishPanel :wish="wish" v-if="selected == i" @closeWish="selected = -1"></WishPanel>
|
||||
</template>
|
||||
</body>
|
||||
</template>
|
||||
Reference in New Issue
Block a user