Commit 876a3c55 authored by Robert's avatar Robert

Demonstration: API-endpoint usage and multi-components

parent a1d35300
Pipeline #1835 failed with stage
in 5 minutes and 42 seconds
......@@ -2,14 +2,18 @@
<div>
<ol>
<li v-for="association in associations" :key="association.id">
{{ association.title }}
<content-preview :association="association"/>
</li>
</ol>
</div>
</template>
<script>
import ContentPreview from './content-preview.vue'
export default {
components: {
ContentPreview
},
data() {
return {
associations: [
......@@ -24,5 +28,15 @@
],
}
},
methods: {
updateContent() {
fetch('/stadt/api/content')
.then(res => res.json())
.then(data => { this.associations = data })
}
},
created() {
this.updateContent()
}
}
</script>
<template>
<div>
{{ association.title }}
</div>
</template>
<script>
export default {
props: {
association: {
type: Object,
required: true
}
}
}
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment