Install axios + Test App rendering + Test API connection

This commit is contained in:
2020-12-03 23:05:00 +01:00
parent dc3a764aa2
commit 69e0f90c5a
7 changed files with 63 additions and 15 deletions

View File

@@ -1,11 +1,26 @@
<template>
<div>
<h1>Fruits Directory</h1>
{{ fruits }}
</div>
</template>
<script>
export default {
name: "Fruits"
name: "Fruits",
data() {
return {
fruits: []
};
},
async mounted() {
await this.getFruits();
},
methods: {
async getFruits() {
const response = await this.$http.get("http://localhost:3000/fruit");
this.fruits = response.data.data;
}
}
};
</script>