add store.json, add _category dynamically showing content

This commit is contained in:
Kevin Van Der Werff
2019-06-15 17:50:28 +02:00
parent f76708b60c
commit c9595c7281
2 changed files with 714 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
<template lang="pug">
div
h1 {{ category.title }}
.cards
template(v-for='resource in category.resources')
Card(:title='resource.title' :desc='resource.desc' :url='resource.url')
</template>
<script>
import store from '../../store.json'
import Card from '../../components/Card'
export default {
data () {
return {
categoryTitle: this.$route.params.category,
categories: store,
}
},
computed: {
category() {
console.log(this.categoryTitle)
console.log(this.categories)
const result = this.categories.find(category => category.title.toLowerCase() === this.categoryTitle.toLowerCase())
console.log(result)
return result
}
},
components: { Card, },
}
</script>