fetching blogs and articles

This commit is contained in:
thomas
2020-02-27 20:22:03 +01:00
parent 97a8b136f0
commit c00452f3d0
10 changed files with 136 additions and 20 deletions
+61
View File
@@ -0,0 +1,61 @@
<template>
<div class="columns">
<div v-for="article in articles" :key="article.id" class="column is-one-third">
<div class="card">
<div class="card-image">
<figure class="image is-4by3">
<img :src="article.image.src" :alt="product.images[0].altText">
</figure>
</div>
<div class="card-content">
<div class="media">
<div class="media-content">
<p class="title is-4">
{{ product.title }}
</p>
<p class="subtitle is-6">
{{ product.variants[0].price }} €
</p>
</div>
</div>
<div class="content">
<b-button
tag="router-link"
:to="'/products/' + product.handle"
type="is-primary"
>
See
</b-button>
<b-button
type="is-primary"
icon-left="cart"
@click="addToCart(product.variants[0].id, 1)"
>
Buy
</b-button>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import cartMixins from '../mixins/cartMixins'
export default {
name: 'ProductCardList',
mixins: [cartMixins],
props: {
products: {
type: Array,
required: true
}
}
}
</script>
<style scoped>
</style>
+21 -12
View File
@@ -1,7 +1,7 @@
<template>
<b-navbar>
<template slot="brand">
<b-navbar-item tag="router-link" to="/">
<b-navbar-item tag="a" href="/">
<img
src="https://raw.githubusercontent.com/buefy/buefy/dev/static/img/buefy-logo.png"
alt="Lightweight UI components for Vue.js based on Bulma"
@@ -10,17 +10,27 @@
</template>
<template slot="start">
<b-navbar-item
tag="router-link"
tag="nuxt-link"
to="/products"
>
Products
</b-navbar-item>
<b-navbar-item
tag="router-link"
to="/blog"
>
Blog
</b-navbar-item>
<b-navbar-dropdown label="Blog">
<b-navbar-item
tag="a"
href="/blog"
>
All
</b-navbar-item>
<b-navbar-item
v-for="blog in blogs"
:key="blog.id"
tag="a"
:href="`/blog/${blog.handle}`"
>
{{ blog.title }}
</b-navbar-item>
</b-navbar-dropdown>
</template>
<template slot="end">
@@ -41,13 +51,12 @@
<script>
export default {
name: 'TheNavbar',
data () {
return {
}
},
computed: {
cardCount () {
return this.$store.state.checkout.lineItems.length
},
blogs () {
return this.$store.state.blogs
}
},
methods: {