forgejo/web_src/js/components/Playground.vue

27 lines
520 B
Vue

<template>
<h1>{{ message }}</h1>
<div>
<p v-if="serverData">{{ serverData.data }}</p>
<button @click="fetchData">Fetch</button>
</div>
</template>
<script>
export default {
data() {
return {
message: 'Test',
serverData : '...'
};
},
methods : {
async fetchData() {
const response = await fetch("http://localhost:3333/data/");
this.serverData = await response.json();
}
}
};
</script>
<style></style>