This commit is contained in:
@@ -1,48 +1,31 @@
|
||||
<script setup>
|
||||
import Wish from '../components/Wish.vue';
|
||||
import {ref, onMounted} from 'vue';
|
||||
import axios from 'axios';
|
||||
import Wish from '../components/Wish.vue';
|
||||
import {ref, onMounted} from 'vue';
|
||||
import axios from 'axios';
|
||||
|
||||
let interval;
|
||||
|
||||
const wishes = ref([]);
|
||||
|
||||
const call = () => {
|
||||
axios
|
||||
.get('/api/get_wishes')
|
||||
.then(response => {
|
||||
wishes.value = response.data;
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
call();
|
||||
interval = setInterval(call, 30000);
|
||||
})
|
||||
</script>
|
||||
<script>
|
||||
let interval;
|
||||
|
||||
export default {
|
||||
setup()
|
||||
{
|
||||
const wishes = ref([]);
|
||||
const something = ref(12);
|
||||
|
||||
return {
|
||||
wishes,
|
||||
something,
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
const call = () => {
|
||||
axios
|
||||
.get('/api/get_wishes')
|
||||
.then(response => {
|
||||
this.wishes = response.data;
|
||||
})
|
||||
}
|
||||
|
||||
console.log(this.something)
|
||||
|
||||
call();
|
||||
interval = setInterval(call, 30000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<body>
|
||||
<template v-for="wish in wishes">
|
||||
<Wish :rune="wish.rune" :type="wish.type" :color="wish.color"/>
|
||||
{{ wish.title }}
|
||||
</template>
|
||||
</body>
|
||||
</template>
|
||||
Reference in New Issue
Block a user