This commit is contained in:
Timo Hocker
2019-09-26 15:07:56 +02:00
parent 9102fe41c2
commit 078ad18862
2 changed files with 27 additions and 20 deletions

View File

@ -1,7 +1,6 @@
<template>
<div id="app">
<div>
{{json}}
<table>
<tr v-for="(row,rowKey) in json" :key="rowKey">
<td v-for="(value,key) in row" :key="key">{{value}}</td>
@ -21,20 +20,34 @@
<script>
export default {
name: "App",
data: {
json: []
data() {
return {
json: []
};
},
mounted() {
const self = this;
fetch("?json")
.then(res => res.json())
.then(json => {
this.json = json;
console.log(this.json);
});
.then(json => (self.json = json));
},
watch: {
json() {
console.log(this.json);
}
}
};
</script>
<style>
@import url("https://cdn.scode.ovh/bootstrapLight.css");
td {
border: 1px solid green;
padding: 5px;
}
table {
border-collapse: collapse;
}
</style>